mirror of
https://github.com/rui314/mold.git
synced 2026-11-09 04:49:33 -10:00
Do not set STT_GNU_IFUNC to symbols .dynsym
We should not set STT_GNU_IFUNC to symbols in .dynsym because from the other ELF module's point of view, it doens't matter whether a symbol is IFUNC or not. This is needed by Gentoo's sci-mathematics/nauty-2.6.7 package.
This commit is contained in:
1 parent
04dcfe2ae3
commit
dd04357363
2 files changed
+40
-1
No files matched your search
+3
-1
@@ -968,7 +968,9 @@ void DynsymSection<E>::copy_buf(Context<E> &ctx) {
|
||||
*(ElfSym<E> *)(base + sym.get_dynsym_idx(ctx) * sizeof(ElfSym<E>));
|
||||
|
||||
memset(&esym, 0, sizeof(esym));
|
||||
esym.st_type = sym.get_type();
|
||||
esym.st_type = sym.esym().st_type;
|
||||
if (esym.st_type == STT_GNU_IFUNC)
|
||||
esym.st_type = STT_FUNC;
|
||||
esym.st_size = sym.esym().st_size;
|
||||
|
||||
if (sym.is_weak)
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
echo -n "Testing $(basename -s .sh $0) ... "
|
||||
t=$(pwd)/tmp/$(basename -s .sh $0)
|
||||
mkdir -p $t
|
||||
|
||||
cat <<EOF | cc -c -fPIC -o $t/a.o -x assembler -
|
||||
.text
|
||||
real_foobar:
|
||||
lea .Lmsg(%rip), %rdi
|
||||
xor %rax, %rax
|
||||
call printf
|
||||
xor %rax, %rax
|
||||
ret
|
||||
|
||||
.globl resolve_foobar
|
||||
resolve_foobar:
|
||||
pushq %rbp
|
||||
movq %rsp, %rbp
|
||||
movq real_foobar@GOTPCREL(%rip), %rax
|
||||
popq %rbp
|
||||
ret
|
||||
|
||||
.globl foobar
|
||||
.type foobar, @gnu_indirect_function
|
||||
.set foobar, resolve_foobar
|
||||
|
||||
.data
|
||||
.Lmsg:
|
||||
.string "Hello world\n"
|
||||
EOF
|
||||
|
||||
clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o
|
||||
readelf --dyn-syms $t/b.so | grep -Pq '0 FUNC GLOBAL DEFAULT \d+ foobar'
|
||||
|
||||
echo OK
|
||||
Reference in new issue
Block a user