GNU ld question
Posted: Wed Jan 04, 2017 1:51 pm
I have a really simple question. The elf documentation states:
I can control any other sections, but not these, because ld simply ignores my rules (so does objdump ignore these sections). I've tried all variations I could think of, I've googled a lot but nothing. I've also checked command line options and maybe if PHDRS command has some magic keyword for it, but nothing. Here's my linker script that I think should work:
And the output:
As you can see, LOAD segment ends at 18140, and symbol table starts at 24098 and not listed in segment mapping.
Please somebody restore my faith in GNU software...
So my question is, how to do that? How to tell ld to include those sections in a loadable segment? The documentation neglect to tell that little detail....strtab
Strings, most commonly the strings that represent the names associated with symbol table entries. If the file has a loadable segment that includes the symbol string table, the section's attributes will include the SHF_ALLOC bit. Otherwise, that bit will be turned off.
.symtab
Symbol table, as "Symbol Table" describes. If the file has a loadable segment that includes the symbol table, the section's attributes will include the SHF_ALLOC bit. Otherwise, that bit will be turned off.
I can control any other sections, but not these, because ld simply ignores my rules (so does objdump ignore these sections). I've tried all variations I could think of, I've googled a lot but nothing. I've also checked command line options and maybe if PHDRS command has some magic keyword for it, but nothing. Here's my linker script that I think should work:
Code: Select all
.text CORE_ADDRESS + SIZEOF_HEADERS + (8192): AT(ADDR(.text) - CORE_ADDRESS + SIZEOF_HEADERS)
{
...
*(.text)
*(.symtab)
*(.strtab)
...
} :text
Code: Select all
Section Headers:
....
[10] .symtab SYMTAB 0000000000000000 000224a8
0000000000001bf0 0000000000000018 11 96 8
[11] .strtab STRTAB 0000000000000000 00024098
0000000000000b9c 0000000000000000 0 0 1
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0xffffffffffe02000 0x0000000000002078
0x0000000000018140 0x0000000000018140 RWE 80
Section to Segment mapping:
Segment Sections...
00 .text .got.plt
Please somebody restore my faith in GNU software...