[PATCH] D57482: [RuntimeDyld] Don't try to allocate sections with alignment 0.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 30 15:52:40 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL352694: [RuntimeDyld] Don't try to allocate sections with align 0. (authored by zturner, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D57482?vs=184390&id=184395#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D57482

Files:
  llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp


Index: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
===================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -743,6 +743,11 @@
   bool IsReadOnly = isReadOnlyData(Section);
   uint64_t DataSize = Section.getSize();
 
+  // An alignment of 0 (at least with ELF) is identical to an alignment of 1,
+  // while being more "polite".  Other formats do not support 0-aligned sections
+  // anyway, so we should guarantee that the alignment is always at least 1.
+  Alignment = std::max(1u, Alignment);
+
   StringRef Name;
   if (auto EC = Section.getName(Name))
     return errorCodeToError(EC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57482.184395.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190130/d3d65b94/attachment.bin>


More information about the llvm-commits mailing list