diff options
author | Fangrui Song <i@maskray.me> | 2020-11-11 09:21:10 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2020-11-11 09:21:10 -0800 |
commit | 20de1822466e87c137b2369d8601b0f4c575981b (patch) | |
tree | b07f719ec377609ae593881079c0d5071846ee51 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | f0580c73bb325baf5fda10c169c2293f21987081 (diff) | |
download | llvm-20de1822466e87c137b2369d8601b0f4c575981b.zip llvm-20de1822466e87c137b2369d8601b0f4c575981b.tar.gz llvm-20de1822466e87c137b2369d8601b0f4c575981b.tar.bz2 |
[llvm-objcopy] --only-keep-debug: place zero-size segment according to its parent segment
Alternative to D74755. sectionWithinSegment() treats an empty section as having
a size of 1. Due to the rule, an empty .tdata will not be attributed to an
empty PT_TLS. (The empty p_align=64 PT_TLS is for Android Bionic's TCB
compatibility (ELF-TLS). See https://reviews.llvm.org/D62055#1507426)
Currently --only-keep-debug will not layout a segment with no section
(layoutSegmentsForOnlyKeepDebug()), thus p_offset of PT_TLS can go past the end
of the file. The strange p_offset can trigger validation errors for subsequent
tools, e.g. llvm-objcopy errors when reading back the separate debug file
(readProgramHeaders()).
This patch places such an empty segment according to its parent segment. This
special cases works for the empty PT_TLS used in Android. For a non-empty
segment, it should have at least one non-empty section and will be handled by
the normal code. Note, p_memsz PT_LOAD is rejected by both Linux and FreeBSD.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D90897
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
0 files changed, 0 insertions, 0 deletions