This reverts commit 870271ea071971002fa556e09e1873db316fa1a9. The commit is broken, you can't unconditionally emit a PC-relative relocation without a symbol. And if there's a symbol the addend need to be in the relocation, not the section.
Unified · Split
| @@ -257,7 +257,8 @@ 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 */ |
| 258 | ST_FUNC void gen_addrpc32(int r, Sym *sym, int c) | 258 | ST_FUNC void gen_addrpc32(int r, Sym *sym, int c) |
| 259 | { | 259 | { |
| 260 | greloca(cur_text_section, sym, ind, R_X86_64_PC32, 0); | 260 | if (r & VT_SYM) |
| 261 | greloca(cur_text_section, sym, ind, R_X86_64_PC32, c-4), c=4; | ||
| 261 | gen_le32(c-4); | 262 | gen_le32(c-4); |
| 262 | } | 263 | } |
| 263 | 264 | ||