History

gen_addrpc32: absolute ptr needs *ABS* relocation

Dereferencing of absolute pointers is broken on x86_64, eg: *(int*)NULL does not segfault but returns -4 instead *(char*)(-10L << 20) does not return 0x55 (vsyscall page, push rbp)

Zdenek Pavlas committed 9 years ago

Commit 870271e1 parent 078d8c21 file · +1 −2Browse files

Unified · Split

x86_64-gen.c+1−2
@@ -257,8 +257,7 @@ ST_FUNC void gen_addr64(int r, Sym *sym, int64_t c) · 256 unmodified lines
257/* output constant with relocation if 'r & VT_SYM' is true */257/* output constant with relocation if 'r & VT_SYM' is true */
258ST_FUNC void gen_addrpc32(int r, Sym *sym, int c)258ST_FUNC void gen_addrpc32(int r, Sym *sym, int c)
259{259{
260 if (r & VT_SYM)260 greloca(cur_text_section, sym, ind, R_X86_64_PC32, 0);
261 greloca(cur_text_section, sym, ind, R_X86_64_PC32, c-4), c=4;
262 gen_le32(c-4);261 gen_le32(c-4);
263}262}
264 263

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t