This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: R_X86_64_COPY bug


On Sun, Apr 7, 2013 at 3:46 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 04/07/2013 03:48 AM, Fredrick Prashanth John Berchmans wrote:
>>
>> A struct with zero length array is defined in a shared library as a global
>> data.
>> A binary links with this shared library and accesses the struct.
>> Because of copy relocation semantics, the binary linking with that
>> library sees(correctly) only the portion of the struct without the
>> zero length array.
>> We understand that it is due to the wrong or apparent size calculation
>> of the struct by GCC and using copy relocation semantics to resolve this
>> shared symbol is causing this problem.
>
>
> This seems to be a bug in GCC:
>
>
>         .globl  test_dynamic
>         .data
>         .align 4
>         .type   test_dynamic, @object
>         .size   test_dynamic, 4
> test_dynamic:
>         .long   6
>         .long   1
>         .long   2
>         .long   3
>         .long   4
>         .long   5
>         .long   6
>
> The .size directive is wrong.  I couldn't find anything matching in
> Bugzilla, so you probably should file a new bug.
>

Filed.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56880



> As a workaround, you could declare the struct object in question as static.
> This should disable copy relocation.
>
> --
> Florian Weimer / Red Hat Product Security Team


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]