Skip to content

Commit

Permalink
Use pointer sized alignment for fat function pointers since they cont…
Browse files Browse the repository at this point in the history
…ain absolute relocations. ld64 seem to silently corrupt them if they are not aligned to pointer size.
  • Loading branch information
filipnavara committed Sep 9, 2022
1 parent cab1de8 commit c12a7be
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
var builder = new ObjectDataBuilder(factory, relocsOnly);

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

builder.AddSymbol(this);

Expand Down

0 comments on commit c12a7be

Please sign in to comment.