History

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.

Michael Matz committed 8 years ago

Commit d79caa91 parent 65c7f193 files · +11 −13Browse files

Showing the changes to tests/tests2/07_function.c (1 of 3 files). Show all

Unified · Split

tests/tests2/07_function.c+5−0
@@ -15,6 +15,11 @@ void qfunc() · 14 unmodified lines
1515 printf("qfunc()\n");
1616 }
1717
18+void zfunc()
19+{
20+ ((void (*)(void))0) ();
21+}
22+
1823 int main()
1924 {
2025 printf("%d\n", myfunc(3));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t