mirror of
https://github.com/mirror/tinycc.git
synced 2026-08-30 11:57:51 +08:00
x86-64: Fix calls via absolute function pointers
linkers don't treat relocations using symindex 0 (undefined) very well, it can't be misused as indicator for an absolute number. Just don't bother with special casing this, rather emit an indirect call/jump right away. ARM64 needs the same (and didn't handle calls via constant absolute func pointers before). The testcase as is doesn't fail without the patch, it actually needs separate compilation (to -fPIC .o file, then to shared lib) to fail.
This commit is contained in:
@@ -15,6 +15,11 @@ void qfunc()
|
||||
printf("qfunc()\n");
|
||||
}
|
||||
|
||||
void zfunc()
|
||||
{
|
||||
((void (*)(void))0) ();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%d\n", myfunc(3));
|
||||
|
||||
Reference in New Issue
Block a user