[PATCH] D41619: [llvm-objcopy] Use physical instead of virtual address when aligning and placing sections in binary

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 02:22:39 PST 2018


jhenderson added a comment.

Could you also add a test for non-binary output, with PAddr set, to show that it is ignored, please.

I don't have any experience with using differing physical and virtual addresses, so I can't really comment on the validity of this. The code looks like it does as desired though. I assume that the virtual address alignment requirement for binary output is not the same as for ELF output, i.e. that it does not have to be congruent to offset mod the alignment?



================
Comment at: tools/llvm-objcopy/Object.cpp:896
+  bool HasAnyPAddr = false;
+  for (const auto &Segment: OrderedSegments) {
+    if (Segment->PAddr != 0) {
----------------
jakehehrlich wrote:
> Can we use std::find_if and a lambda here instead?
Better yet, we can use std::any_of here, to remove the need for the std::end check.


================
Comment at: tools/llvm-objcopy/Object.cpp:913
     Seg->MemSize -= Diff;
     // The VAddr needs to be adjusted so that the alignment is correct as well
     Seg->VAddr += Diff;
----------------
The VAddr needs -> The VAddr and PAddr need


https://reviews.llvm.org/D41619





More information about the llvm-commits mailing list