https://sourceware.org/bugzilla/show_bug.cgi?id=27491
Bug ID: 27491 Summary: ld: relocation R_X86_64_PC32 against undefined protected symbol `__start_xx' can not be used when making a shared object Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: i at maskray dot me Target Milestone: --- % cat x.s .weak __start_xx .weak __stop_xx .global _start _start: movq __start_xx@gotpcrel(%rip), %rdi movq __stop_xx@gotpcrel(%rip), %rsi .section xx,"a",unique,0 .byte 0 .section xx,"a",unique,1 .byte 1 % as x.s -o x.o # With an ld newer than 2021-03-01 % ./ld-new x.o --gc-sections --print-gc-sections -z start-stop-gc -shared ./ld-new: removing unused section 'xx' in file 'x.o' ./ld-new: removing unused section 'xx' in file 'x.o' ./ld-new: x.o: relocation R_X86_64_PC32 against undefined protected symbol `__start_xx' can not be used when making a shared object ./ld-new: final link failed: bad value I suspect GOTPCRELX optimization is performed while it shouldn't. aarch64 ld works without a diagnostic. -- You are receiving this mail because: You are on the CC list for the bug.