From 77d7ea04acb56f839031993c102366e30cad5c25 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 18 Dec 2016 05:18:19 +0100 Subject: Fix gawk miscompile See testcase. Function pointer use was hosed when the destination function wasn't also called normally by the program. --- i386-link.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'i386-link.c') diff --git a/i386-link.c b/i386-link.c index c098172..c232f39 100644 --- a/i386-link.c +++ b/i386-link.c @@ -56,12 +56,17 @@ int gotplt_entry_type (int reloc_type) switch (reloc_type) { case R_386_RELATIVE: case R_386_16: - case R_386_32: case R_386_GLOB_DAT: case R_386_JMP_SLOT: case R_386_COPY: return NO_GOTPLT_ENTRY; + case R_386_32: + /* This relocations shouldn't normally need GOT or PLT + slots if it weren't for simplicity in the code generator. + See our caller for comments. */ + return AUTO_GOTPLT_ENTRY; + case R_386_PC16: case R_386_PC32: return AUTO_GOTPLT_ENTRY; -- cgit v1.3.1