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 ... --- wiena...@coopers:/tmp/test$ cat main.c int main(void) { return 0; } wiena...@coopers:/tmp/test$ gcc -o main main.c one.c wiena...@coopers:/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=10302 ------- 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