[all-commits] [llvm/llvm-project] 976de5: [MC, MachO] Replace SectionAddrMap workaround with ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Apr 6 13:08:04 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 976de53f1008a9e06c94a99fdd59d0f523feaef7
      https://github.com/llvm/llvm-project/commit/976de53f1008a9e06c94a99fdd59d0f523feaef7
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-04-06 (Sun, 06 Apr 2025)

  Changed paths:
    M llvm/lib/MC/MachObjectWriter.cpp
    M llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
    M llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp

  Log Message:
  -----------
  [MC,MachO] Replace SectionAddrMap workaround with cleaner variable handling

Mach-O's ARM and X86 writers use MCExpr's `SectionAddrMap *Addrs`
argument to compute label differences, which was a bit of a hack. The
AArch64MachObjectWriter does this better by using `getSymbolAddress` in
its `recordRelocation` function.

This commit:
1. Moves the `SectionAddrMap` logic into the Mach-O code, removing the
   workaround.
2. Fixes a bug in `MachObjectWriter::getSymbolAddress` where it failed
   to subtract the `SymB` value. This bug has been present since commit
   b200f93125eb019d69c220fa447faea4f5d4eb8a (2011).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list