Skip to content

Commit

Permalink
More x86 reloc fixes (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillou68310 authored Feb 9, 2025
1 parent 4f1215f commit ea17698
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,11 @@ def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]:
# Offset value

# Example movb $0x0,0x4
# Example %edi,4
if not addr_imm:
addr_imm = re.search(r"(?:0x)?[0-9a-f]+$", args)
offset = True

# Example movb $0x0,0x4(%si)
if not addr_imm:
addr_imm = re.search(r"(?<=,)0x[0-9a-f]+", args)
Expand Down Expand Up @@ -2925,6 +2930,14 @@ def process(dump: str, config: Config) -> List[Line]:
break
i += 1

# Example call 0 <func_name>
if arch.name is "x86" and mnemonic == "call" and comment and symbol is None:
addr_imm = re.search(r"(?:0x)?0+$", original)
if addr_imm is not None:
start, end = addr_imm.span()
symbol = comment[1 : len(comment) - 1]
original = original[:start] + symbol

is_text_relative_j = False
if (
arch.name in MIPS_ARCH_NAMES
Expand Down

1 comment on commit ea17698

@1superchip
Copy link
Collaborator

@1superchip 1superchip commented on ea17698 Feb 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is meant to fix an issue of the assembler not generating relocations the expected way to functions defined in the same input assembly. Can we structure this fix the same as 79a8bbe?

Please sign in to comment.