[PATCH] D98323: [lld-macho] implement options -map
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 16 19:15:12 PDT 2021
int3 added inline comments.
================
Comment at: lld/test/MachO/map-file.s:28-29
+# CHECK-NEXT: # Address Size Segment Section
+# CHECK-NEXT: 0x100000308 0x00000001 __TEXT __text
+# CHECK-NEXT: 0x100000309 0x00000000 __TEXT obj
+# CHECK-NEXT: # Symbols:
----------------
int3 wrote:
> int3 wrote:
> > We try not to match against hardcoded addresses because they're a bit of a pain to update. In this case I think it would be better to match this against `llvm-objdump`'s output: something like
> >
> > ```
> > RUN: llvm-objdump --syms --section-headers %t/test-map > %t/objdump
> > RUN: cat %t/objdump %t/map > %t/out
> > RUN: FileCheck %s < %t/out
> > ```
> >
> > Then we can use [[ https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-numeric-substitution-blocks | numeric substitutions ]] to check that the values line up.
> this still needs to be addressed
So right now the test is just ignoring the value, but it would be better if it checked that it matched the actual addresses in the binary using numeric substitutions. It would be something like this:
```
# RUN: llvm-objdump --syms --section-headers %t/test-map > %t/objdump
# RUN: cat %t/objdump %t/map > %t/out
# RUN: FileCheck %s < %t/out
...
# CHECK: Sections:
# CHECK-NEXT: Idx Name Size VMA Type
# CHECK-NEXT: 0 __text {{[0-9a-f]+}} [[#%x,TEXT:]] TEXT
...
# CHECK-NEXT: # Sections:
# CHECK-NEXT: # Address Size Segment Section
# CHECK-NEXT: 0x[[#TEXT]] 0x00000001 __TEXT __text
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98323/new/
https://reviews.llvm.org/D98323
More information about the llvm-commits
mailing list