$ cat a.s
        .file   "a.c"
        .type   a,@object
        .section        .rodata.str1.1,"aMS",@progbits,1
        .globl a
a:
        .size   a, 5  # note that size is 5!
        .align  8
        .byte   0x61
        .byte   0x62
        .zero   1
        .type   b,@object
        .globl b
b:
        .size   b, 2
        .byte   0x62
        .zero   1

        .section        .note.GNU-stack,"",@progbits

$ as -o a.o a.s
$ ld -shared -o a.so a.o
$ readelf -a a.o
(...)
     7: 00000000     5 OBJECT  GLOBAL DEFAULT    4 a
     8: 00000003     2 OBJECT  GLOBAL DEFAULT    4 b
(note that 'a' has size 5)

$ objdump -s a.so
Contents of section .rodata:
 0160 61620000 00000000                    ab......

As you can see, the value for the symbol 'a' is broken. It should be 'ab\0b\0'.

-- 
           Summary: ld string merge does not respect symbol size
           Product: binutils
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: nunoplopes at sapo dot pt
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11002

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to