[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/27973] New: ld x86: Allow direct access to protected function sy
From: |
i at maskray dot me |
Subject: |
[Bug ld/27973] New: ld x86: Allow direct access to protected function symbols |
Date: |
Wed, 09 Jun 2021 17:04:58 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27973
Bug ID: 27973
Summary: ld x86: Allow direct access to protected function
symbols
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: ---
// a.c
__attribute__((visibility("protected"))) void *foo () {
return (void *)foo;
}
// This roughly maps to:
.globl foo
.protected foo
.type foo, @function
foo:
leaq foo(%rip), %rax
% gcc -fpic -shared -fuse-ld=bfd a.s
/usr/bin/ld.bfd: /tmp/ccWPJCLw.o: relocation R_X86_64_PC32 against protected
symbol `foo' can not be used when making a shared object
/usr/bin/ld.bfd: final link failed: bad value
collect2: error: ld returned 1 exit status
The diagnostic was probably added circa 2016/2017 to make copy relocations on
protected data symbols work with glibc.
It should not apply to function symbols.
The "copy relocations on protected data symbols" scheme has some fragile
support with GNU ld and glibc on x86 (acked by multiple glibc maintainers).
It definitely did not work before circa 2016, and should not work in the
future.
This scheme does not work with gold or LLD.
GNU ld for non-x86 architectures don't work.
I think no software will break if we drop the fragile glibc support.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/27973] New: ld x86: Allow direct access to protected function symbols,
i at maskray dot me <=
- [Bug ld/27973] ld x86: Allow direct access to protected function symbols, i at maskray dot me, 2021/06/10
- [Bug ld/27973] ld x86: Allow direct access to protected function symbols, i at maskray dot me, 2021/06/12
- [Bug ld/27973] ld x86: Allow direct access to protected function symbols, cvs-commit at gcc dot gnu.org, 2021/06/17
- [Bug ld/27973] ld x86: Allow direct access to protected function symbols, cvs-commit at gcc dot gnu.org, 2021/06/17
- [Bug ld/27973] ld x86: Allow direct access to protected function symbols, hjl.tools at gmail dot com, 2021/06/17
- [Bug ld/27973] ld x86: Allow direct access to protected function symbols, hjl.tools at gmail dot com, 2021/06/17