[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/30217] New: PowerPC: R_PPC64_JMP_SLOT relocation on local std:
From: |
dante at cadence dot com |
Subject: |
[Bug gold/30217] New: PowerPC: R_PPC64_JMP_SLOT relocation on local std::map symbol when using -mlongcall and --version-script |
Date: |
Fri, 10 Mar 2023 12:34:37 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30217
Bug ID: 30217
Summary: PowerPC: R_PPC64_JMP_SLOT relocation on local std::map
symbol when using -mlongcall and --version-script
Product: binutils
Version: 2.40
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: dante at cadence dot com
CC: ian at airs dot com
Target Milestone: ---
Created attachment 14743
--> https://sourceware.org/bugzilla/attachment.cgi?id=14743&action=edit
Reproducer program
runme.sh:
-------------------------------------------------------------
#!/bin/sh
#GCC_ROOT=/home/dante/gcc/v9.3.0
GCC_ROOT=/home/dante/gcc/v12.2.0
BINUTILS_ROOT=/home/dante/binutils/v2.40
export PATH="${BINUTILS_ROOT}/bin:${GCC_ROOT}/bin:$PATH"
export LD_LIBRARY_PATH="${GCC_ROOT}/lib64"
LD=gold
ld.$LD -V | head -1
rm *.cpp *.so exe mapfile >& /dev/null
cat > exe.cpp <<- EOM
extern "C" {
int fooPublic();
int main() {
return fooPublic();
}
}
EOM
cat > libfoo.cpp <<- EOM
#include <map>
static std::map<int, int> fooMap;
extern "C" {
int fooPublic() { return 0; }
}
EOM
cat > mapfile <<- EOM
{
global: fooPublic;
local: *;
};
EOM
g++ -B${BINUTILS_ROOT}/bin \
-mlongcall -fPIC libfoo.cpp \
-Wl,--version-script=mapfile \
-fuse-ld=$LD \
-shared \
-o libfoo.so
g++ -B${BINUTILS_ROOT}/bin -L. -Wl,-rpath=`pwd` -lfoo exe.cpp -o exe
echo symbols:
nm libfoo.so | grep _ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC1Ev
echo relocations:
readelf -W -r libfoo.so | grep _ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC1Ev
./exe
-------------------------------------------------------------
gcc 12.2.0 on ppc64le (bug also happens on gcc 9.3.0):
$ ./runme.sh
GNU gold (GNU Binutils 2.40.0.20230310) 1.16
symbols:
00000000000017d8 t _ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC1Ev
relocations:
0000000000020248 0000000700000015 R_PPC64_JMP_SLOT 00000000000017d8
_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC1Ev + 0
./exe: symbol lookup error: /home/dante/tst/pltseq/libfoo.so: undefined symbol:
_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC1Ev
-------------------------------------------------------------
Works when LD=bfd.
Also works when compiling with -mno-pltseq.
Running binutils v2.40 configured with:
./configure --prefix=/home/dante/binutils/v2.40 --enable-shared
--enable-plugins --enable-gold --enable-threads
Confirmed to also fail on binutils 2.38 and 2.39.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gold/30217] New: PowerPC: R_PPC64_JMP_SLOT relocation on local std::map symbol when using -mlongcall and --version-script,
dante at cadence dot com <=