x86-64: relocation addend is 64bit

Some routines were using the wrong type (int) in passing addends,
truncating it.  This matters when bit 31 isn't set and the high
32 bits are set: the truncation would make it unsigned where in
reality it's signed (happen e.g. on the x86-64 with it's load
address at top-2GB).
This commit is contained in:
Michael Matz
2016-09-29 16:57:30 +02:00
parent 975c74c1f5
commit b5669a952b
3 changed files with 6 additions and 6 deletions

View File

@ -165,14 +165,14 @@ ST_FUNC int oad(int c, int s)
}
/* output constant with relocation if 'r & VT_SYM' is true */
ST_FUNC void gen_addr32(int r, Sym *sym, int c)
ST_FUNC void gen_addr32(int r, Sym *sym, long c)
{
if (r & VT_SYM)
greloc(cur_text_section, sym, ind, R_386_32);
gen_le32(c);
}
ST_FUNC void gen_addrpc32(int r, Sym *sym, int c)
ST_FUNC void gen_addrpc32(int r, Sym *sym, long c)
{
if (r & VT_SYM)
greloc(cur_text_section, sym, ind, R_386_PC32);