mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
x86-64: Prefer 32S relocations
This target has _32 and _32S relocs (the latter being for signed 32 bit entities). All instruction displacements have to use the 32S variants. Normal references like .long s normally would use the _32 variant. For normal executables this doesn't matter. For shared libraries neither (which use PC-relative relocs). But it matters for things like the kernel that are linked to high addresses (signed ones). There the GNU linker would error out on overflow for the _32 variant. To keep life simple we simply switch from _32 to _32S altogether. Strictly speaking it's still wrong, but in practice using _32 is more often wrong than using _32S ;)
This commit is contained in:
parent
ad8e14b740
commit
975c74c1f5
@ -242,7 +242,7 @@ ST_FUNC int oad(int c, int s)
|
||||
ST_FUNC void gen_addr32(int r, Sym *sym, int c)
|
||||
{
|
||||
if (r & VT_SYM)
|
||||
greloca(cur_text_section, sym, ind, R_X86_64_32, c), c=0;
|
||||
greloca(cur_text_section, sym, ind, R_X86_64_32S, c), c=0;
|
||||
gen_le32(c);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#define EM_TCC_TARGET EM_X86_64
|
||||
|
||||
/* relocation type for 32 bit data relocation */
|
||||
#define R_DATA_32 R_X86_64_32
|
||||
#define R_DATA_32 R_X86_64_32S
|
||||
#define R_DATA_PTR R_X86_64_64
|
||||
#define R_JMP_SLOT R_X86_64_JUMP_SLOT
|
||||
#define R_GLOB_DAT R_X86_64_GLOB_DAT
|
||||
|
Loading…
Reference in New Issue
Block a user