[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26407] New: Global symbol reference breaks without -Bsymbolic-fu
From: |
address@hidden |
Subject: |
[Bug ld/26407] New: Global symbol reference breaks without -Bsymbolic-functions |
Date: |
Wed, 19 Aug 2020 14:46:49 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26407
Bug ID: 26407
Summary: Global symbol reference breaks without
-Bsymbolic-functions
Product: binutils
Version: 2.34
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: fabian@ritter-vogt.de
Target Milestone: ---
Updating binutils to 2.35 broke libQt5Core5.so.5, QCoreApplication::self didn't
work anymore (https://bugzilla.suse.com/show_bug.cgi?id=1175278#c9).
It's caused by "ld: Handle --dynamic-list* before -Bsymbolic
-Bsymbolic-functions", which effectively means that -Bsymbolic-functions is
ignored if --dynamic-list is given, so the issue can be replicated on 2.34 as
well.
break.i:
void setValue(int v);
extern int value;
int main()
{
setValue(42);
return value;
}
lib.i:
int value = 0;
void setValue(int v) {
value = v;
}
lib.dynlist:
{
extern "C" {
"setValue";
};
};
With -Bsymbolic-functions, it works as expected:
> gcc -fPIC -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,lib.dynlist -o
> lib.so lib.i && readelf --dyn-syms -r lib.so | grep value
000000003fe8 000600000006 R_X86_64_GLOB_DAT 0000000000004024 value + 0
6: 0000000000004024 4 OBJECT GLOBAL DEFAULT 22 value
> gcc -Wl,--no-undefined lib.so break.i -o break && LD_LIBRARY_PATH=$PWD
> ./break; echo $?
42
Without, the relocation is missing and setValue writes into a different value
than main reads from:
> gcc -fPIC -shared -Wl,--dynamic-list,lib.dynlist -o lib.so lib.i && readelf
> --dyn-syms -r lib.so | grep value
6: 0000000000004024 4 OBJECT GLOBAL DEFAULT 22 value
> gcc -Wl,--no-undefined lib.so break.i -o break && LD_LIBRARY_PATH=$PWD
> ./break; echo $?
0
If "value" is mentioned in lib.dynlist or --dynamic-list-data is used it works,
so it seems like objects have to be mentioned in lib.dynlist as well.
But then the symbol should be missing entirely and linking fail, instead of
just the missing relocation resulting in runtime issues, right?
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/26407] New: Global symbol reference breaks without -Bsymbolic-functions,
address@hidden <=
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, hjl.tools at gmail dot com, 2020/08/19
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, address@hidden, 2020/08/20
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, mliska at suse dot cz, 2020/08/20
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, hjl.tools at gmail dot com, 2020/08/20
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, hjl.tools at gmail dot com, 2020/08/20
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, address@hidden, 2020/08/20
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, hjl.tools at gmail dot com, 2020/08/20
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, matz at suse dot de, 2020/08/24
- [Bug ld/26407] Global symbol reference breaks without -Bsymbolic-functions, hjl.tools at gmail dot com, 2020/08/24