[PATCH] D87497: [llvm-objcopy][MachO] Fix --add-section
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 16:40:02 PDT 2020
alexshap added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/MachO/Object.cpp:122
+ case MachO::LC_SEGMENT:
+ Addr = std::max(Addr, (uint64_t)MLC.segment_command_data.vmaddr +
+ MLC.segment_command_data.vmsize);
----------------
smeenai wrote:
> Same question about alignment here.
>
> Also nit: I thought `static_cast` was preferred to C-style casts.
Segments (vmaddr/vmsize) are aligned by pagesize so in this case everything is fine.
Answering your question above - at the moment we do not align a new section added to an existing segment, perhaps, this might be revisited later, it might depend on what that section contains etc.
In any case - vmsize is updated by llvm-objcopy and it will be properly aligned (see MachOLayoutBuilder.cpp).
P.S. In the real-world use-case (which I've been working on) llvm-objcopy is used for injecting a new segment
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87497/new/
https://reviews.llvm.org/D87497
More information about the llvm-commits
mailing list