https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93492

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Fangrui Song from comment #7)
> > Is -fasynchronous-unwind-tables compatible with -fpatchable-function-entry?
> 
> Apparently the Linux kernel does not care about it. To make it usable in
> userspace, we should place .cfi_startproc in a reasonable place.

My patch should handle it.

> (A more concerning issue is that __patchable_function_entries can be
> stripped by -Wl,--gc-sections , as the bug I linked above describes)

I opened:

https://sourceware.org/bugzilla/show_bug.cgi?id=25490

> #### Interaction with -g1 (line table)

My patch doesn't handle this one.  Handle this one requires changing
DWARF prologue generation.

> % clang -g -fpatchable-function-entry=2 a.c -o a  # latest clang
> % addr2line -e a 0x$(nm a | awk '/ main/{print $1}')
> /tmp/c/a.c:1
> 
> % gcc -g -fpatchable-function-entry=2 a.c -o a
> % addr2line -e a 0x$(nm a | awk '/ main/{print $1}')
> ??:?
> 
> For M>0, I think it is fine to leave NOPs before the function entry
> uncovered by line table information. clang -fpatchable-function-entry=2,1
> layout is the same as #c2, except for a NOP above foo:
> 
> % clang -g -fpatchable-function-entry=2,1 a.c -o a
> # or gcc -g -fpatchable-function-entry=2,1 a.c -o a
> % addr2line -e a $(nm a | ruby -ane 'print ($F[0].to_i(16)-1).to_s(16) if /
> main/')
> crtstuff.c:?

Reply via email to