public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bschmidt@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>,
	       Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Jason Merrill <jason@redhat.com>
Subject: Re: [PATCH] PR middle-end/67220: GCC fails to properly handle libcall symbol visibility of built functions
Date: Tue, 20 Oct 2015 23:43:00 -0000	[thread overview]
Message-ID: <5626D034.6000306@redhat.com> (raw)
In-Reply-To: <CAMe9rOo_=_8BTjsQTuAMOQ0w1Td+9f52AyS-SF1kJNdLP5=Xsw@mail.gmail.com>

On 10/15/2015 12:37 PM, H.J. Lu wrote:
> On Thu, Oct 15, 2015 at 1:44 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Wed, Oct 14, 2015 at 6:21 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>>> By default, there is no visibility on builtin functions.  When there is
>>> explicitly declared visibility on the C library function which a builtin
>>> function fall back on, we should honor the explicit visibility on the
>>> the C library function.

>> Doesn't the C++ FE have the same issue?
>>
>
> Unlike gcc, visibility triggers a warning in g++:
>
> memcpy.i:2:14: warning: ‘void* memcpy(void*, const void*, size_t)’:
> visibility attribute ignored because it conflicts with previous
> declaration [-Wattributes]
>   extern void *memcpy(void *dest, const void *src, size_t n)
>                ^
> <built-in>: note: previous declaration of ‘void* memcpy(void*, const
> void*, size_t)’
> [hjl@gnu-tools-1 pr67220]$

I see no good reason for C and C++ to have different behaviour here. It 
looks like the C++ frontend sets DECL_VISIBILITY_SPECIFIED to 1 for 
builtins, causing the above behaviour. Cc'ing Jason, but I think the C++ 
frontend should be changed not to set D_V_S and have the same changes as 
the C frontend for merging the visibilities.

Other than that I don't see a problem with the concept. However, I also 
agree that the tests should not be i386 specific.

One final question - it would seem that glibc is currently not affected 
by this problem (at least I'm not seeing memcpy@plt calls in the binary 
on my system), so how come this has become an issue now?


Bernd

  reply	other threads:[~2015-10-20 23:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 16:21 H.J. Lu
2015-10-14 16:46 ` Ramana Radhakrishnan
2015-10-14 16:51   ` H.J. Lu
2015-10-14 17:17     ` Ramana Radhakrishnan
2015-10-15  8:44 ` Richard Biener
2015-10-15 10:38   ` H.J. Lu
2015-10-20 23:43     ` Bernd Schmidt [this message]
2015-10-21  3:42       ` H.J. Lu
2016-01-15 18:44       ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5626D034.6000306@redhat.com \
    --to=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jason@redhat.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).