aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-02-21 21:29:03 +0000
committerEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-02-21 21:29:03 +0000
commit738606dbd5608cb2ed6789beecea40712809c397 (patch)
tree5905c3fa381607f962f2cc75d68c280ab5d03eba /libtcc.c
parent86c850fc58a70ff4b77c37d91e33ce6c812b04c4 (diff)
downloadtinycc-738606dbd5608cb2ed6789beecea40712809c397.tar.gz
tinycc-738606dbd5608cb2ed6789beecea40712809c397.tar.bz2
Use RELA relocations properly for R_DATA_PTR on x86_64.
libtcc.c: Add greloca, a generalisation of greloc that takes an addend. tcc.h: Add greloca and put_elf_reloca. tccelf.c: Add put_elf_reloca, a generalisation of put_elf_reloc. tccgen.c: On x86_64, use greloca instead of greloc in init_putv.
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libtcc.c b/libtcc.c
index 711cdd2..01497b2 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -536,7 +536,8 @@ ST_FUNC void put_extern_sym(Sym *sym, Section *section,
}
/* add a new relocation entry to symbol 'sym' in section 's' */
-ST_FUNC void greloc(Section *s, Sym *sym, unsigned long offset, int type)
+ST_FUNC void greloca(Section *s, Sym *sym, unsigned long offset, int type,
+ unsigned long addend)
{
int c = 0;
if (sym) {
@@ -545,7 +546,12 @@ ST_FUNC void greloc(Section *s, Sym *sym, unsigned long offset, int type)
c = sym->c;
}
/* now we can add ELF relocation info */
- put_elf_reloc(symtab_section, s, offset, type, c);
+ put_elf_reloca(symtab_section, s, offset, type, c, addend);
+}
+
+ST_FUNC void greloc(Section *s, Sym *sym, unsigned long offset, int type)
+{
+ greloca(s, sym, offset, type, 0);
}
/********************************************************/