[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 24 17:11:26 PST 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4f2a4617936f: [lld-macho] Have all load commands aligned to the word size (authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141462/new/

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.491965.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230125/99f984ed/attachment.bin>


More information about the llvm-commits mailing list