https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93492
Fangrui Song <i at maskray dot me> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |i at maskray dot me
--- Comment #2 from Fangrui Song <i at maskray dot me> ---
On Clang's side. After https://reviews.llvm.org/D73760 , clang -target x86_64
-fpatchable-function-entry=2,0 -fcf-protection=branch -S a.c -g:
.cfi_startproc is placed at the function entry, so that NOPs after the function
entry are in the CFI region
.loc directive is similar. The idea is that addr2line at the function address
should show the correct filename and line, instead of ??:0.
foo: # @foo
.Lfoo$local:
.Lfunc_begin0:
.file 1 "/tmp/c" "a.c"
.loc 1 3 0 # a.c:3:0
.cfi_startproc
# %bb.0: # %entry
endbr64
.Lpatch0:
xchgw %ax, %ax
...
.section
__patchable_function_entries,"awo",@progbits,foo,unique,0
.p2align 3
.quad .Lpatch0
The section flag "o" and the linkage "unique" (LLVM assembly extensions) are
used to fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93197 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93195 .
I have filed GNU as feature requests
(https://sourceware.org/bugzilla/show_bug.cgi?id=25380
https://sourceware.org/bugzilla/show_bug.cgi?id=25381). GNU ld needs required
garbage collection semantics
https://sourceware.org/ml/binutils/2019-11/msg00266.html)