Skip to content

Commit c12a7be

Browse files
committed
Use pointer sized alignment for fat function pointers since they contain absolute relocations. ld64 seem to silently corrupt them if they are not aligned to pointer size.
1 parent cab1de8 commit c12a7be

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
6060
{
6161
var builder = new ObjectDataBuilder(factory, relocsOnly);
6262

63-
// These need to be aligned the same as methods because they show up in same contexts
64-
builder.RequireInitialAlignment(factory.Target.MinimumFunctionAlignment);
63+
// These need to be aligned the same as method pointers because they show up in same contexts
64+
// (macOS ARM64 has even stricter alignment requirement for the linker, so round up to pointer size)
65+
builder.RequireInitialAlignment(factory.Target.PointerSize);
6566

6667
builder.AddSymbol(this);
6768

0 commit comments

Comments
 (0)