[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault |
Date: |
Mon, 17 Aug 2015 23:28:31 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=18841
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
This usage is ill defined. Small changes change the run-time
behavior:
1. Use -O2 causes it to pass with ld:
address@hidden pr18841]$ make
gcc -B./ -O2 -g -c -o main.o main.c
gcc -B./ -O2 -g -fpic -c -o foo.o foo.c
gcc -B./ -shared -o libfoo.so foo.o
gcc -B./ -o main main.o libfoo.so -Wl,-R.
./main
address@hidden pr18841]$
2. Make pz file scope causes it to fail with gold and ld:
address@hidden pr18841-bad]$ cat foo.c
void foo() __attribute__((ifunc("resolve_foo")));
static void foo_impl() {}
extern void zoo(void);
void (*pz)(void) = zoo;
void test()
{
void (*pg)(void) = foo;
pg();
}
static void* resolve_foo()
{
pz();
return foo_impl;
}
address@hidden pr18841-bad]$ make
gcc -B./ -fuse-ld=gold -g -fpic -c -o foo.o foo.c
gcc -B./ -fuse-ld=gold -shared -o libfoo.so foo.o
gcc -B./ -fuse-ld=gold -o main main.o libfoo.so -Wl,-R.
./main
Makefile:17: recipe for target 'all' failed
make: *** [all] Segmentation fault
address@hidden pr18841-bad]$
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/18841] New: Data relocations with IFUNC symbols can lead to segfault, amonakov at gmail dot com, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault,
hjl.tools at gmail dot com <=
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, amodra at gmail dot com, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, cvs-commit at gcc dot gnu.org, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, hjl.tools at gmail dot com, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, amonakov at gmail dot com, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, hjl.tools at gmail dot com, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, hjl.tools at gmail dot com, 2015/08/18
- [Bug ld/18841] Data relocations with IFUNC symbols can lead to segfault, cvs-commit at gcc dot gnu.org, 2015/08/18