map-file.test 2.7 KB
# REQUIRES: x86

# RUN: echo '.quad sym3; .quad sym4; .section .foo.1, "a"; .quad 1' > %t.s
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o

# RUN: ld.lld -o %t %t.o -Map=%t.map --script %s
# RUN: FileCheck -strict-whitespace %s < %t.map

SECTIONS {
  . = 0x1000;
  .foo : {
    BYTE(0x11)
    SHORT(0x1122)
    LONG(0x11223344)
    QUAD(0x1122334455667788)
    PROVIDE_HIDDEN(sym4 = .);
    . += 0x1000;
    *(.foo.1)
    PROVIDE(unused1 = 0xff);
    HIDDEN(sym6 = .);
    . += 0x123 *
         (1 + 1);
    foo = .;
    bar = 0x42 - 0x26;
  }
  sym1 = .;
  . += 0x500;
  sym2 = .;
  PROVIDE(unused2 = 0xff);
  PROVIDE(sym3 = 42);
}

# CHECK:         VMA              LMA     Size Align Out     In      Symbol
# CHECK-NEXT:      0                0     1000     1 . = 0x1000
# CHECK-NEXT:   1000             1000     125d     1 .foo
# CHECK-NEXT:   1000             1000        1     1         BYTE ( 0x11 )
# CHECK-NEXT:   1001             1001        2     1         SHORT ( 0x1122 )
# CHECK-NEXT:   1003             1003        4     1         LONG ( 0x11223344 )
# CHECK-NEXT:   1007             1007        8     1         QUAD ( 0x1122334455667788 )
# CHECK-NEXT:   100f             100f        0     1         PROVIDE_HIDDEN ( sym4 = . )
# CHECK-NEXT:   100f             100f     1000     1         . += 0x1000
# CHECK-NEXT:   200f             200f        8     1         {{.*}}{{/|\\}}map-file.test.tmp.o:(.foo.1)
# CHECK-NEXT:   2017             2017        0     1         HIDDEN ( sym6 = . )
# CHECK-NEXT:   2017             2017      246     1         . += 0x123 * ( 1 + 1 )
# CHECK-NEXT:   225d             225d        0     1         foo = .
# CHECK-NEXT:   225d             225d        0     1         bar = 0x42 - 0x26
# CHECK-NEXT:   225d             225d        0     1 sym1 = .
# CHECK-NEXT:   225d             225d      500     1 . += 0x500
# CHECK-NEXT:   275d             275d        0     1 sym2 = .
# CHECK-NEXT:   275d             275d        0     1 PROVIDE ( sym3 = 42 )
# CHECK-NEXT:   2760             2760       10     4 .text
# CHECK-NEXT:   2760             2760       10     4         {{.*}}{{/|\\}}map-file.test.tmp.o:(.text)
# CHECK-NEXT:      0                0        8     1 .comment
# CHECK-NEXT:      0                0        8     1         <internal>:(.comment)
# CHECK-NEXT:      0                0       c0     8 .symtab
# CHECK-NEXT:      0                0       c0     8         <internal>:(.symtab)
# CHECK-NEXT:      0                0       2f     1 .shstrtab
# CHECK-NEXT:      0                0       2f     1         <internal>:(.shstrtab)
# CHECK-NEXT:      0                0       22     1 .strtab
# CHECK-NEXT:      0                0       22     1         <internal>:(.strtab)