bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/25903] New: aarch64: gold drops __EH_FRAME_BEGIN__ with static


From: nsz at gcc dot gnu.org
Subject: [Bug gold/25903] New: aarch64: gold drops __EH_FRAME_BEGIN__ with static linking
Date: Fri, 01 May 2020 11:54:31 +0000

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

            Bug ID: 25903
           Summary: aarch64: gold drops __EH_FRAME_BEGIN__ with static
                    linking
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: nsz at gcc dot gnu.org
                CC: ian at airs dot com
  Target Milestone: ---

$ cat a.c
#include <stdio.h>
#include <unwind.h>
#include <stdint.h>
#include <signal.h>

static _Unwind_Reason_Code unwind_backtrace_callback(struct _Unwind_Context*
context, void* arg)
{
    uintptr_t pc = _Unwind_GetIP(context);
    printf("unwind pc 0x%lx\n", pc);
    return _URC_NO_REASON;
}

int main()
{
    _Unwind_Reason_Code rc = _Unwind_Backtrace(unwind_backtrace_callback, 0);
    return rc == _URC_END_OF_STACK ? 0 : -1;
}
$ aarch64-none-linux-gnu-gcc -static a.c && ./a.out
unwind pc 0x4007bc
unwind pc 0x405c1c
unwind pc 0x400648
$ aarch64-none-linux-gnu-readelf -aW ./a.out |grep -i eh_frame
  [13] .eh_frame         PROGBITS        000000000046edb8 06edb8 00b0b0 00   A 
0   0  8
   00     .note.gnu.property .note.ABI-tag .rela.plt .init .plt .text
__libc_freeres_fn .fini .rodata __libc_subfreeres __libc_IO_vtables
__libc_atexit .eh_frame .gcc_except_table
    81: 000000000046edb8     0 OBJECT  LOCAL  DEFAULT   13 __EH_FRAME_BEGIN__

$ aarch64-none-linux-gnu-gcc -static -fuse-ld=gold a.c && ./a.out
Aborted (core dumped)
$ aarch64-none-linux-gnu-readelf -aW ./a.out |grep -i eh_frame
  [13] .eh_frame         PROGBITS        000000000046ee00 06ee00 00b80c 00   A 
0   0  8
   00     .note.ABI-tag .rela.plt .init .plt .text __libc_freeres_fn .fini
.rodata __libc_subfreeres __libc_IO_vtables .gcc_except_table __libc_atexit
.eh_frame
$

it seems ld.gold drops __EH_FRAME_BEGIN__ local symbol, a simpler example:

$ echo 'void _start(){}' |aarch64-none-linux-gnu-gcc -xc -c -o start.o -

$ aarch64-none-linux-gnu-ld -Bstatic `aarch64-none-linux-gnu-gcc
--print-file-name crtbeginT.o` start.o `aarch64-none-linux-gnu-gcc
--print-file-name crtend.o`
$ aarch64-none-linux-gnu-readelf -aW a.out |grep -i eh_frame                   
                                              [ 4] .eh_frame         PROGBITS  
     00000000004002e0 0002e0 0000a0 00   A  0   0  8
   00     .note.gnu.property .text .rodata .eh_frame
    12: 00000000004002e0     0 OBJECT  LOCAL  DEFAULT    4 __EH_FRAME_BEGIN__

$ aarch64-none-linux-gnu-ld.gold -Bstatic `aarch64-none-linux-gnu-gcc
--print-file-name crtbeginT.o` start.o `aarch64-none-linux-gnu-gcc
--print-file-name crtend.o`
$ aarch64-none-linux-gnu-readelf -aW a.out |grep -i eh_frame
  [ 3] .eh_frame         PROGBITS        0000000000400250 000250 0000b4 00   A 
0   0  8
   00     .text .rodata .eh_frame
$

but

$ aarch64-none-linux-gnu-readelf -aW `aarch64-none-linux-gnu-gcc
--print-file-name crtbeginT.o` |grep -i eh_frame
  [ 9] .eh_frame         PROGBITS        0000000000000000 000158 000088 00   A 
0   0  8
  [10] .rela.eh_frame    RELA            0000000000000000 0009e8 000060 18   I
17   9  8
000000000000009c  0000000700000113 R_AARCH64_ADR_PREL_PG_HI21 0000000000000000
.eh_frame + 0
00000000000000a0  0000000700000115 R_AARCH64_ADD_ABS_LO12_NC 0000000000000000
.eh_frame + 0
00000000000000e4  0000000700000113 R_AARCH64_ADR_PREL_PG_HI21 0000000000000000
.eh_frame + 0
00000000000000e8  0000000700000115 R_AARCH64_ADD_ABS_LO12_NC 0000000000000000
.eh_frame + 0
Relocation section '.rela.eh_frame' at offset 0x9e8 contains 4 entries:
     9: 0000000000000000     0 OBJECT  LOCAL  DEFAULT    9 __EH_FRAME_BEGIN__
$ aarch64-none-linux-gnu-readelf -aW start.o |grep -i eh_frame
  [ 7] .eh_frame         PROGBITS        0000000000000000 0000c0 000028 00   A 
0   0  8
  [ 8] .rela.eh_frame    RELA            0000000000000000 000230 000018 18   I 
9   7  8
Relocation section '.rela.eh_frame' at offset 0x230 contains 1 entry:
$ aarch64-none-linux-gnu-readelf -aW `aarch64-none-linux-gnu-gcc
--print-file-name crtend.o` |grep -i eh_frame
  [ 4] .eh_frame         PROGBITS        0000000000000000 000040 000004 00   A 
0   0  4

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]