aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tccelf.c b/tccelf.c
index 02caa68..dc0a144 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -269,8 +269,8 @@ ST_FUNC int add_elf_sym(Section *s, addr_t value, unsigned long size,
}
/* put relocation */
-ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset,
- int type, int symbol)
+ST_FUNC void put_elf_reloca(Section *symtab, Section *s, unsigned long offset,
+ int type, int symbol, unsigned long addend)
{
char buf[256];
Section *sr;
@@ -292,10 +292,19 @@ ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset,
rel->r_offset = offset;
rel->r_info = ELFW(R_INFO)(symbol, type);
#ifdef TCC_TARGET_X86_64
- rel->r_addend = 0;
+ rel->r_addend = addend;
+#else
+ if (addend)
+ tcc_error("non-zero addend on REL architecture");
#endif
}
+ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset,
+ int type, int symbol)
+{
+ put_elf_reloca(symtab, s, offset, type, symbol, 0);
+}
+
/* put stab debug information */
ST_FUNC void put_stabs(const char *str, int type, int other, int desc,