public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Andreas Krebbel <krebbel@linux.vnet.ibm.com>,
	 Bernd Schmidt <bschmidt@redhat.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix default_binds_local_p_2 for extern protected data
Date: Wed, 14 Oct 2015 09:56:00 -0000	[thread overview]
Message-ID: <561E26A8.5030800@arm.com> (raw)
In-Reply-To: <560C36B7.3050306@linux.vnet.ibm.com>

On 30/09/15 20:23, Andreas Krebbel wrote:
> On 09/30/2015 06:21 PM, Szabolcs Nagy wrote:
>> On 30/09/15 14:47, Bernd Schmidt wrote:
>>> On 09/17/2015 11:15 AM, Szabolcs Nagy wrote:
>>>> ping 2.
>>>>
>>>> this patch is needed for working visibility ("protected")
>>>> attribute for extern data on targets using default_binds_local_p_2.
>>>> https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01871.html
>>>
>>> I hesitate to review this one since I don't think I understand the
>>> issues on the various affected arches well enough. It looks like Jakub
>>> had some input on the earlier changes, maybe he could take a look? Or
>>> maybe rth knows best. Adding Ccs.
>>>
>>> It would help to have examples of code generation demonstrating the
>>> problem and how you would solve it. Input from the s390 maintainers
>>> whether this is correct for their port would also be appreciated.
>
> We are having the same problem on S/390. I think the GCC change is correct for S/390 as well.
>
> -Andreas-
>

i think the approvals of arm and aarch64 maintainers
are needed to apply this fix for pr target/66912.

(only s390, arm and aarch64 use this predicate.)

>>>
>>
>> consider the TU
>>
>>     __attribute__((visibility("protected"))) int n;
>>
>>     int f () { return n; }
>>
>> if n "binds_local" then gcc -O -fpic -S is like
>>
>>           .text
>>           .align  2
>>           .global f
>>           .arch armv8-a+fp+simd
>>           .type   f, %function
>> f:
>>           adrp    x0, n
>>           ldr     w0, [x0, #:lo12:n]
>>           ret
>>           .size   f, .-f
>>           .protected      n
>>           .comm   n,4,4
>>
>> so 'n' is a direct reference, not accessed through
>> the GOT ('n' will be in the .bss of the dso).
>> this is the current behavior.
>>
>> if i remove the protected visibility attribute
>> then the access goes through GOT:
>>
>>           .text
>>           .align  2
>>           .global f
>>           .arch armv8-a+fp+simd
>>           .type   f, %function
>> f:
>>           adrp    x0, _GLOBAL_OFFSET_TABLE_
>>           ldr     x0, [x0, #:gotpage_lo15:n]
>>           ldr     w0, [x0]
>>           ret
>>           .size   f, .-f
>>           .comm   n,4,4
>>
>> protected visibility means the definition cannot
>> be overridden by another module, but it should
>> still allow extern references.
>>
>> if the main module references such an object then
>> (as an implementation detail) it may use copy
>> relocation against it, which places 'n' in the
>> main module and the dynamic linker should make
>> sure that references to 'n' point there.
>>
>> this is only possible if references to 'n' go
>> through the GOT (i.e. it should not be "binds_local").
>
>
>
>
>

  reply	other threads:[~2015-10-14  9:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 17:06 Szabolcs Nagy
2015-08-10 11:04 ` Szabolcs Nagy
2015-09-17  9:32   ` Szabolcs Nagy
2015-09-30 15:02     ` Bernd Schmidt
2015-09-30 16:43       ` Szabolcs Nagy
2015-09-30 20:28         ` Andreas Krebbel
2015-10-14  9:56           ` Szabolcs Nagy [this message]
2015-10-19 10:12             ` Szabolcs Nagy
2015-10-19 18:53 ` Richard Henderson

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=561E26A8.5030800@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=krebbel@linux.vnet.ibm.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).