[lld] wasm-ld: Implement function pointer alignment (PR #105532)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 14 10:04:07 PDT 2025
================
@@ -563,8 +563,24 @@ void ElemSection::addEntry(FunctionSymbol *sym) {
// They only exist so that the calls to missing functions can validate.
if (sym->hasTableIndex() || sym->isStub)
return;
+
+ uint32_t padding = 0;
+ uint64_t alignment = 1;
+
+ if (indirectFunctions.size() == 0 && padding > 0) {
+ for (uint32_t i=0; i<padding; i++) {
+ indirectFunctions.push_back(nullptr);
+ }
+ }
----------------
MaskRay wrote:
llvm/include/llvm/Support/MathExtras.h has ` constexpr T alignTo(U Value, V Align, W Skew)`, which might help here
https://github.com/llvm/llvm-project/pull/105532
More information about the llvm-commits
mailing list