mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-11 17:10:45 +08:00
macho/reloc: Allow absolute relocation when forcing a symbol reference
The (fake) section for absolute symbols is not in the linked list. So, when the section is not found from the index, now it simply points to the special section. Based-on-code-from: zenith432 <zenith432@users.sourceforge.net> Signed-off-by: Chang S. Bae <changseok.bae@gmail.com>
This commit is contained in:
parent
625ea1ca47
commit
960efc3ff2
@ -514,7 +514,6 @@ static int64_t add_reloc(struct section *sect, int32_t section,
|
||||
if (section == NO_SEG) {
|
||||
/* absolute (can this even happen?) */
|
||||
r->ext = 0;
|
||||
r->snum = NO_SECT;
|
||||
} else if (fi == NO_SECT) {
|
||||
/* external */
|
||||
r->snum = raa_read(extsyms, section);
|
||||
@ -593,9 +592,13 @@ static int64_t add_reloc(struct section *sect, int32_t section,
|
||||
break;
|
||||
}
|
||||
|
||||
/* For 64-bit Mach-O, force a symbol reference if at all possible */
|
||||
if (!r->ext && r->snum != NO_SECT && fmt.forcesym) {
|
||||
struct symbol *sym = macho_find_sym(s, offset, false, false);
|
||||
/*
|
||||
* For 64-bit Mach-O, force a symbol reference if at all possible
|
||||
* Allow for r->snum == R_ABS by searching absolute_sect
|
||||
*/
|
||||
if (!r->ext && fmt.forcesym) {
|
||||
struct symbol *sym = macho_find_sym(s ? s : &absolute_sect,
|
||||
offset, false, false);
|
||||
if (sym) {
|
||||
adjust = bytes - sym->symv[0].key;
|
||||
r->snum = sym->initial_snum;
|
||||
|
Loading…
Reference in New Issue
Block a user