unsigned long secthead_count,
elf_section_index shstrtab_index);
+enum {
+ ELF_SSYM_SYM_RELATIVE = 1 << 0,
+ ELF_SSYM_CURPOS_ADJUST = 1 << 1
+};
+
typedef struct {
const char *name; /* should be something like ..name */
const int sym_rel; /* symbol or section-relative? */
wrt = NULL;
else if (wrt && elf_is_wrt_sym_relative(wrt))
;
+ else if (wrt && elf_is_wrt_pos_adjusted(wrt))
+ intn_val = offset + bc->offset;
else if (vis == YASM_SYM_LOCAL) {
yasm_bytecode *sym_precbc;
/* Local symbols need relocation to their section's start, and
}
static elf_machine_ssym elf_x86_amd64_ssyms[] = {
- {"..gotpcrel", 1},
- {"..got", 1},
+ {"..gotpcrel", ELF_SSYM_SYM_RELATIVE},
+ {"..got", ELF_SSYM_SYM_RELATIVE},
{"..plt", 0}
};
}
static elf_machine_ssym elf_x86_x86_ssyms[] = {
- {"..gotpc", 0},
+ {"..gotpc", ELF_SSYM_CURPOS_ADJUST},
{"..gotoff", 0},
- {"..got", 1},
+ {"..got", ELF_SSYM_SYM_RELATIVE},
{"..plt", 0}
};
}
/* reloc functions */
+int elf_ssym_has_flag(yasm_symrec *wrt, int flag);
+
int
elf_is_wrt_sym_relative(yasm_symrec *wrt)
+{
+ return elf_ssym_has_flag(wrt, ELF_SSYM_SYM_RELATIVE);
+}
+
+int
+elf_is_wrt_pos_adjusted(yasm_symrec *wrt)
+{
+ return elf_ssym_has_flag(wrt, ELF_SSYM_CURPOS_ADJUST);
+}
+
+int
+elf_ssym_has_flag(yasm_symrec *wrt, int flag)
{
int i;
for (i=0; (unsigned int)i<elf_march->num_ssyms; i++) {
if (elf_ssyms[i] == wrt)
- return elf_march->ssyms[i].sym_rel;
+ return (elf_march->ssyms[i].sym_rel & flag) != 0;
}
return 0;
}
/* reloc functions */
int elf_is_wrt_sym_relative(yasm_symrec *wrt);
+int elf_is_wrt_pos_adjusted(yasm_symrec *wrt);
elf_reloc_entry *elf_reloc_entry_create(yasm_symrec *sym,
/*@null@*/ yasm_symrec *wrt,
yasm_intnum *addr,
5b
81
c3
-e9
-ff
-ff
-ff
+03
+00
+00
+00
8b
83
00