[Bug middle-end/93197] -fpatchable-function-entries : __patchable_function_entries does not survive under --gc-sections

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 3 21:26:00 GMT 2020


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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixing PR 93195 will also fix this:

[hjl@gnu-cfl-1 pr93197]$ cat a.c 
void foo() {}
[hjl@gnu-cfl-1 pr93197]$ cat b.c 
extern void foo(void);

void
_start ()
{
  foo ();
}
[hjl@gnu-cfl-1 pr93197]$ make
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/
-fpatchable-function-entry=1  -S a.c
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/
-fpatchable-function-entry=1  -S b.c
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/
-fpatchable-function-entry=1  -c -o a.o a.s
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/
-fpatchable-function-entry=1  -c -o b.o b.s
ld --gc-sections -o x a.o b.o
readelf -SW x | grep __patchable_function_entries
  [ 4] __patchable_function_entries PROGBITS        0000000000404000 003000
000010 00 WAL  2   0  8
[hjl@gnu-cfl-1 pr93197]$ cat a.s
        .file   "a.c"
        .text
        .globl  foo
        .type   foo, @function
foo:
        .section        __patchable_function_entries,"awo",@progbits,foo
        .align 8
        .quad   .LPFE1
        .text
.LPFE1:
        nop
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        nop
        popq    %rbp
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 10.0.1 20200203 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-1 pr93197]$ cat b.s
        .file   "b.c"
        .text
        .globl  _start
        .type   _start, @function
_start:
        .section        __patchable_function_entries,"awo",@progbits,_start
        .align 8
        .quad   .LPFE1
        .text
.LPFE1:
        nop
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        call    foo
        nop
        popq    %rbp
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE0:
        .size   _start, .-_start
        .ident  "GCC: (GNU) 10.0.1 20200203 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-1 pr93197]$

*** This bug has been marked as a duplicate of bug 93195 ***


More information about the Gcc-bugs mailing list