[PATCH] D141462: [lld-macho] Have all load commands aligned to the word size
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 23:47:38 PST 2023
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is what ld64 does, and also what we already do for most of the
other load commands. I'm not aware of a good way to test this, but I
don't think it really matters.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141462
Files:
lld/MachO/Writer.cpp
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -328,7 +328,8 @@
}
uint32_t getSize() const override {
- return alignTo(sizeof(dylib_command) + path.size() + 1, 8);
+ return alignToPowerOf2(sizeof(dylib_command) + path.size() + 1,
+ target->wordSize);
}
void writeTo(uint8_t *buf) const override {
@@ -362,7 +363,8 @@
class LCLoadDylinker final : public LoadCommand {
public:
uint32_t getSize() const override {
- return alignTo(sizeof(dylinker_command) + path.size() + 1, 8);
+ return alignToPowerOf2(sizeof(dylinker_command) + path.size() + 1,
+ target->wordSize);
}
void writeTo(uint8_t *buf) const override {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141462.488089.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230111/2e690506/attachment.bin>
More information about the llvm-commits
mailing list