https://bugs.llvm.org/show_bug.cgi?id=43935
Bug ID: 43935
Summary: --add-symbol produces invalid symbol table for ELF
with program headers and no symbol table
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: llvm-objcopy/strip
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected],
[email protected],
[email protected],
[email protected], [email protected]
If you attempt to add a symbol to an ELF with no symbol table, a symbol table
is created. However, if there are program headers, the offset of that symbol
table is invalid (uint64_t max):
## test.yaml:
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .foo
Type: SHT_PROGBITS
ProgramHeaders:
- Type: PT_LOAD
Sections:
- Section: .foo
C:\Work> yaml2obj test.yaml -o test.elf
C:\Work> llvm-objcopy test.elf test2.elf --add-symbol foo=1234
C:\Work> llvm-readelf test2.elf --sections
There are 5 section headers, starting at offset 0xa0:
Section Headers:
[Nr] Name Type Address Off Size ES Flg
Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00
0 0 0
[ 1] .foo PROGBITS 0000000000000000 000078 000000 00
0 0 0
[ 2] .strtab STRTAB 0000000000000000 000078 000005 00
0 0 1
[ 3] .shstrtab STRTAB 0000000000000000 00007d 000020 00
0 0 1
[ 4] .symtab SYMTAB 0000000000000000 ffffffffffffffff
000030 18 2 1 8
This is not an issue if there are no program headers (the offset of the symbol
table is correct).
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs