bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/10303] New: ld merging smaller strings into larger strings?


From: ianw at vmware dot com
Subject: [Bug ld/10303] New: ld merging smaller strings into larger strings?
Date: 19 Jun 2009 21:22:19 -0000

I specify some strings in a section in an object file, and everything looks 
good.

---
$ cat one.c
#define STRING(symbol)                                       \
   asm(".pushsection " ".asection" ",\"aSM\", @progbits, 1\n" \
       "\t.string \"" #symbol "\" \n"                         \
       "\t.popsection\n");

STRING(abc);
STRING(abcdef);
STRING(def);

$ gcc -c one.c
$ objdump --full-contents -j ".asection" ./one.o 

./one.o:     file format elf64-x86-64

Contents of section .asection:
 0000 61626300 61626364 65660064 656600    abc.abcdef.def. 

---

Then I link this together, and the final "def" disappears ...

---
address@hidden:/tmp/test$ cat main.c
int main(void) { return 0; }  
address@hidden:/tmp/test$ gcc -o main main.c one.c
address@hidden:/tmp/test$ objdump --full-contents -j ".asection" ./main

./main:     file format elf64-x86-64

Contents of section .asection:
 40057c 61626300 61626364 656600             abc.abcdef.     
---

I'm quite unsure why the final def is merged out?  The documentation suggests 
the merging will be done at the level of a null terminated string [1]; if this 
is not so maybe it could be made more clear?

[1] http://sourceware.org/binutils/docs-2.19/as/Section.html

-- 
           Summary: ld merging smaller strings into larger strings?
           Product: binutils
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: ianw at vmware dot com
                CC: bug-binutils at gnu dot org


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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]