R_X86_64_COPY bug

Alan Modra amodra@gmail.com
Sat Apr 6 07:13:00 GMT 2013
On Fri, Apr 05, 2013 at 09:29:09PM -0700, Fredrick Prashanth John Berchmans wrote:
> Dear binutils developers,
> 
> We are seeing a issue with copy relocation semantics in ld.
> 
> A struct with zero length array is defined in a shared library.
> Because of copy relocation semantics, any binary linking with that
> library sees those elements as zero initialized.
> 
> We saw this bug also on ARM with R_ARM_COPY.

This is not a bug in gas or ld.  gcc is sizing the struct incorrectly.

        .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

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list