https://sourceware.org/bugzilla/show_bug.cgi?id=25756
Bug ID: 25756 Summary: absolute_symbol@GOTPCREL (@GOT) is mishandled Product: binutils Version: 2.35 (HEAD) Status: NEW Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com Target Milestone: --- Target: i386, x86-64 [hjl@gnu-cfl-2 pr25754]$ cat yy.S .text .p2align 4 .globl get_bar .type get_bar, @function get_bar: .cfi_startproc movq bar@GOTPCREL(%rip), %rax ret .cfi_endproc .size get_bar, .-get_bar bar = 0x1fffffff0 .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 pr25754]$ gcc -c yy.S [hjl@gnu-cfl-2 pr25754]$ readelf -r yy.o Relocation section '.rela.text' at offset 0x1b8 contains 1 entry: Offset Info Type Sym. Value Sym. Name + Addend 000000000003 00000000002a R_X86_64_REX_GOTP 1ffffffec Relocation section '.rela.eh_frame' at offset 0x1d0 contains 1 entry: Offset Info Type Sym. Value Sym. Name + Addend 000000000020 000100000002 R_X86_64_PC32 0000000000000000 .text + 0 [hjl@gnu-cfl-2 pr25754]$ clang -c yy.S [hjl@gnu-cfl-2 pr25754]$ readelf -r yy.o Relocation section '.rela.text' at offset 0xd8 contains 1 entry: Offset Info Type Sym. Value Sym. Name + Addend 000000000003 000100000009 R_X86_64_GOTPCREL 00000001fffffff0 bar - 4 Relocation section '.rela.eh_frame' at offset 0xf0 contains 1 entry: Offset Info Type Sym. Value Sym. Name + Addend 000000000020 000200000002 R_X86_64_PC32 0000000000000000 .text + 0 [hjl@gnu-cfl-2 pr25754]$ [hjl@gnu-cfl-2 pr25754]$ cat yy-32.S .text .p2align 4 .globl get_bar .type get_bar, @function get_bar: .cfi_startproc movl bar@GOT(%eax), %eax ret .cfi_endproc .size get_bar, .-get_bar bar = 0xfffffff0 .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 pr25754]$ gcc -c yy-32.S -m32 [hjl@gnu-cfl-2 pr25754]$ readelf -r yy-32.o Relocation section '.rel.eh_frame' at offset 0x15c contains 1 entry: Offset Info Type Sym.Value Sym. Name 00000020 00000102 R_386_PC32 00000000 .text [hjl@gnu-cfl-2 pr25754]$ clang -c yy-32.S -m32 [hjl@gnu-cfl-2 pr25754]$ readelf -r yy-32.o Relocation section '.rel.text' at offset 0xb4 contains 1 entry: Offset Info Type Sym.Value Sym. Name 00000002 00000103 R_386_GOT32 fffffff0 bar Relocation section '.rel.eh_frame' at offset 0xbc contains 1 entry: Offset Info Type Sym.Value Sym. Name 00000020 00000202 R_386_PC32 00000000 .text [hjl@gnu-cfl-2 pr25754]$ -- You are receiving this mail because: You are on the CC list for the bug.