[PATCH] D58426: llvm-objcopy: Change sectionWithinSegment() to use virtual addresses instead of file offsets for SHT_NOBITS sections.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 17:21:32 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361578: llvm-objcopy: Change sectionWithinSegment() to use virtual addresses instead of… (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58426?vs=201097&id=201103#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58426/new/
https://reviews.llvm.org/D58426
Files:
llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
Index: llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
===================================================================
--- llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
+++ llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
@@ -809,6 +809,20 @@
// segments and ensures that the section "belongs" to the second segment and
// not the first.
uint64_t SecSize = Section.Size ? Section.Size : 1;
+
+ if (Section.Type == SHT_NOBITS) {
+ if (!(Section.Flags & SHF_ALLOC))
+ return false;
+
+ bool SectionIsTLS = Section.Flags & SHF_TLS;
+ bool SegmentIsTLS = Segment.Type == PT_TLS;
+ if (SectionIsTLS != SegmentIsTLS)
+ return false;
+
+ return Segment.VAddr <= Section.Addr &&
+ Segment.VAddr + Segment.MemSize >= Section.Addr + SecSize;
+ }
+
return Segment.Offset <= Section.OriginalOffset &&
Segment.Offset + Segment.FileSize >= Section.OriginalOffset + SecSize;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58426.201103.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190524/a16ed149/attachment.bin>
More information about the llvm-commits
mailing list