Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309174
b: refs/heads/master
c: 8a3b947
h: refs/heads/master
v: v3
  • Loading branch information
H. Peter Anvin committed May 18, 2012
1 parent c271c34 commit 26a861a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c54a354c1835e7412a53458891b9ea05361b4e8a
refs/heads/master: 8a3b947c40cb36100f316ac0d433f4ae554ee4cc
11 changes: 8 additions & 3 deletions trunk/arch/x86/tools/relocs.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,14 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
Elf32_Sym *sym;
unsigned r_type;
const char *symname;
int shn_abs;

rel = &sec->reltab[j];
sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
r_type = ELF32_R_TYPE(rel->r_info);

shn_abs = sym->st_shndx == SHN_ABS;

switch (r_type) {
case R_386_NONE:
case R_386_PC32:
Expand All @@ -589,7 +593,7 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
symname = sym_name(sym_strtab, sym);
if (!use_real_mode)
goto bad;
if (sym->st_shndx == SHN_ABS) {
if (shn_abs) {
if (is_reloc(S_ABS, symname))
break;
else if (!is_reloc(S_SEG, symname))
Expand All @@ -605,7 +609,7 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),

case R_386_32:
symname = sym_name(sym_strtab, sym);
if (sym->st_shndx == SHN_ABS) {
if (shn_abs) {
if (is_reloc(S_ABS, symname))
break;
else if (!is_reloc(S_REL, symname))
Expand All @@ -623,7 +627,8 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
break;
bad:
symname = sym_name(sym_strtab, sym);
die("Invalid %s relocation: %s\n",
die("Invalid %s %s relocation: %s\n",
shn_abs ? "absolute" : "relative",
rel_type(r_type), symname);
}
}
Expand Down

0 comments on commit 26a861a

Please sign in to comment.