[PATCH] D58426: llvm-objcopy: Change sectionWithinSegment() to use virtual addresses instead of file offsets.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 21 11:32:36 PST 2019
pcc added a comment.
The change to `segment-test-remove-section.test` merely changes it from a broken ELF file (where the segment covers vaddrs 0x0000-0x3000 but the sections cover vaddrs 0x1000-0x4000) to a non-broken one (where both cover the same vaddrs). This causes `sectionWithinSegment` to return the right answer for the sections in the segment after my code change; without the test change, llvm-objcopy will move `.text3` outside of the segment (since, from the vaddr point of view, it *is* outside of the segment).
I couldn't figure out a good way to test this (other than "we handle broken ELF files slightly differently", which doesn't seem very useful to test for). I tried adding a bss section to the test but I couldn't see a change in behaviour (the behaviour appears to be correct either way).
The change that I'm working on will add a feature that, among other things, strips all SHF_ALLOC sections that are not within a segment. Of course, this needs to classify bss sections correctly, otherwise we will end up stripping them as well.
I could take another look to see if there is a useful change in behaviour for non-broken ELF files. Otherwise this can wait until my other change is ready, I suppose.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58426/new/
https://reviews.llvm.org/D58426
More information about the llvm-commits
mailing list