[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 May 23 17:00:41 PDT 2019
pcc updated this revision to Diff 201097.
pcc added a comment.
Address review comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58426/new/
https://reviews.llvm.org/D58426
Files:
llvm/tools/llvm-objcopy/ELF/Object.cpp
Index: llvm/tools/llvm-objcopy/ELF/Object.cpp
===================================================================
--- llvm/tools/llvm-objcopy/ELF/Object.cpp
+++ llvm/tools/llvm-objcopy/ELF/Object.cpp
@@ -820,6 +820,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.201097.patch
Type: text/x-patch
Size: 900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190524/92c2d56a/attachment.bin>
More information about the llvm-commits
mailing list