[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/29087] New: "non-canonical reference to canonical protected func
From: |
thiago at kde dot org |
Subject: |
[Bug ld/29087] New: "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions |
Date: |
Fri, 22 Apr 2022 23:50:36 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=29087
Bug ID: 29087
Summary: "non-canonical reference to canonical protected
function" with protected visibility,
-mno-direct-extern-access and virtual functions
Product: binutils
Version: 2.38
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: thiago at kde dot org
Target Milestone: ---
Created attachment 14078
--> https://sourceware.org/bugzilla/attachment.cgi?id=14078&action=edit
Testcase
Related to (possibly caused by the fix to) bug 28875.
$ cat lib.h
#ifdef BUILD
# define LIB_API __attribute__((visibility("protected")))
#else
# define LIB_API __attribute__((visibility("default")))
#endif
struct LIB_API S
{
virtual ~S();
virtual void f();
};
$ cat lib.cpp
#define BUILD
#include "lib.h"
S::~S() { }
void S::f() { }
$ cat main.cpp
#include "lib.h"
struct Local : S { };
int main()
{
Local l;
}
$ gmake
g++ -shared -fPIC -mno-direct-extern-access -O2 -g -o lib.so lib.cpp
g++ -c -fPIE -mno-direct-extern-access -O2 -g main.cpp
g++ main.o lib.so
/usr/bin/ld: main.o: non-canonical reference to canonical protected function
`_ZN1S1fEv' in lib.so
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:5: a.out] Error 1
$ eu-readelf -r main.o | sed -n '/.data.rel.ro._ZTV5Local/,/^$/p'
Relocation section [18] '.rela.data.rel.ro._ZTV5Local' for section [17]
'.data.rel.ro._ZTV5Local' at offset 0xb58 contains 4 entries:
Offset Type Value Addend Name
0x0000000000000008 X86_64_64 000000000000000000 +0 _ZTI5Local
0x0000000000000010 X86_64_64 000000000000000000 +0 _ZN5LocalD1Ev
0x0000000000000018 X86_64_64 000000000000000000 +0 _ZN5LocalD0Ev
0x0000000000000020 X86_64_64 000000000000000000 +0 _ZN1S1fEv
$ eu-readelf --dyn-syms lib.so
Symbol table [ 5] '.dynsym' contains 14 entries:
1 local symbol String table: [ 6] '.dynstr'
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF
1: 0000000000000000 0 FUNC WEAK DEFAULT UNDEF
__cxa_finalize@GLIBC_2.2.5 (2)
2: 0000000000000000 0 OBJECT GLOBAL DEFAULT UNDEF
_ZTVN10__cxxabiv117__class_type_infoE@CXXABI_1.3 (3)
3: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF
_ZdlPvm@CXXABI_1.3.9 (4)
4: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF
_ITM_deregisterTMCloneTable
5: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF __gmon_start__
6: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF
_ITM_registerTMCloneTable
7: 0000000000001110 1 FUNC GLOBAL PROTECTED 14 _ZN1SD1Ev
8: 0000000000001110 1 FUNC GLOBAL PROTECTED 14 _ZN1SD2Ev
9: 0000000000001120 1 FUNC GLOBAL PROTECTED 14 _ZN1S1fEv
10: 0000000000001130 10 FUNC GLOBAL PROTECTED 14 _ZN1SD0Ev
11: 0000000000002000 3 OBJECT WEAK PROTECTED 16 _ZTS1S
12: 0000000000003dd0 16 OBJECT WEAK PROTECTED 21 _ZTI1S
13: 0000000000003da8 40 OBJECT WEAK PROTECTED 21 _ZTV1S
$ gcc -v |& tail -1
gcc version 12.0.1 20220420 (experimental) releases/gcc-11.2.0-1089-g691af15031
(Clear Linux OS for Intel Architecture)
$ ld -v
GNU ld (GNU Binutils) 2.38
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/29087] New: "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions,
thiago at kde dot org <=
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, hjl.tools at gmail dot com, 2022/04/22
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, hjl.tools at gmail dot com, 2022/04/25
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, thiago at kde dot org, 2022/04/25
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, thiago at kde dot org, 2022/04/25
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, hjl.tools at gmail dot com, 2022/04/26
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, thiago at kde dot org, 2022/04/26
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, cvs-commit at gcc dot gnu.org, 2022/04/28
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, cvs-commit at gcc dot gnu.org, 2022/04/28
- [Bug ld/29087] "non-canonical reference to canonical protected function" with protected visibility, -mno-direct-extern-access and virtual functions, hjl.tools at gmail dot com, 2022/04/28