Skip to content

Commit 4f2a461

Browse files
committed
[lld-macho] Have all load commands aligned to the word size
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. Differential Revision: https://reviews.llvm.org/D141462
1 parent 388b8c1 commit 4f2a461

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lld/MachO/Writer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ class LCDylib final : public LoadCommand {
328328
}
329329

330330
uint32_t getSize() const override {
331-
return alignTo(sizeof(dylib_command) + path.size() + 1, 8);
331+
return alignToPowerOf2(sizeof(dylib_command) + path.size() + 1,
332+
target->wordSize);
332333
}
333334

334335
void writeTo(uint8_t *buf) const override {
@@ -362,7 +363,8 @@ uint32_t LCDylib::instanceCount = 0;
362363
class LCLoadDylinker final : public LoadCommand {
363364
public:
364365
uint32_t getSize() const override {
365-
return alignTo(sizeof(dylinker_command) + path.size() + 1, 8);
366+
return alignToPowerOf2(sizeof(dylinker_command) + path.size() + 1,
367+
target->wordSize);
366368
}
367369

368370
void writeTo(uint8_t *buf) const override {

0 commit comments

Comments
 (0)