When linking, using -Wl,-z,keep-text-section-prefix results in multiple text sections while all SHT_LLVM_BB_ADDR_MAP sections are linked into a single one.
In such case, we should not read the corresponding section for each text section, and instead read all SHT_LLVM_BB_ADDR_MAP sections before disassembly.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM, but maybe give it a bit in case @MaskRay has anything to add (especially given the relation this has to linking).
-Wl,-z,-keep-text-section-prefix
Typo: -Wl,-z,keep-text-section-prefix. I am still reading the impl...
The subject line usually doesn't have the trailing period.
A SHT_LLVM_BB_ADDR_MAP section does not have SHF_ALLOC. One such section referencing multiple text sections is fine. If a referenced text section is discarded (e.g. due to --gc-sections), the relocated location in SHT_LLVM_BB_ADDR_MAP will be zero.
llvm/test/tools/llvm-objdump/X86/elf-bbaddrmap-disassemble-symbolize-operands.yaml | ||
---|---|---|
114 | If the preferred name is .llvm_bb_addr_map*, better to use it for most tests. You may keep one using a different name to check that the section name doesn't matter. | |
llvm/tools/llvm-objdump/llvm-objdump.cpp | ||
1282 | llvm style doesn't add a blank line after a variable declaration. |
If the preferred name is .llvm_bb_addr_map*, better to use it for most tests. You may keep one using a different name to check that the section name doesn't matter.