llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.69k stars 11.87k forks source link

ld64.lld should warn on underaligned functions #55177

Open nico opened 2 years ago

nico commented 2 years ago

ld64 does this (on an m1 host):

% cat foo.s
.subsections_via_symbols
.globl _f
_f:
  ret
% clang -shared -target arm64-apple-macos foo.s                                                                                         
ld: warning: arm64 function not 4-byte aligned: _f from /var/folders/w6/wpbtszrs7jl9dc9l5qtdkvg00000gn/T/foo-691246.o

We don't, but should:

% clang -shared -target arm64-apple-macos foo.s -fuse-ld=$PWD/out/gn/bin/ld64.lld
llvmbot commented 2 years ago

@llvm/issue-subscribers-lld-macho