aboutsummaryrefslogtreecommitdiff
path: root/i386-link.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-12-18 05:18:19 +0100
committerMichael Matz <matz@suse.de>2016-12-18 05:20:14 +0100
commit77d7ea04acb56f839031993c102366e30cad5c25 (patch)
tree0e31c78f0462ff78b43a5bcb488984fb3ed4d5e3 /i386-link.c
parentcd9514abc4f4d7d90acce108b98ea2af58a1b80a (diff)
downloadtinycc-77d7ea04acb56f839031993c102366e30cad5c25.tar.gz
tinycc-77d7ea04acb56f839031993c102366e30cad5c25.tar.bz2
Fix gawk miscompile
See testcase. Function pointer use was hosed when the destination function wasn't also called normally by the program.
Diffstat (limited to 'i386-link.c')
-rw-r--r--i386-link.c7
1 files changed, 6 insertions, 1 deletions
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;