zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob 52070cbc (1982B) - Raw


      1 # REQUIRES: x86
      2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
      3 # RUN: ld.lld %t.o -o %t
      4 # RUN: llvm-objdump -t -section-headers %t | FileCheck %s
      5 
      6 ## This checks that:
      7 ## 1) Address of _etext is the first location after the last read-only loadable segment.
      8 ## 2) Address of _edata points to the end of the last non SHT_NOBITS section.
      9 ##    That is how gold/bfd do. At the same time specs says: "If the address of _edata is
     10 ##    greater than the address of _etext, the address of _end is same as the address
     11 ##    of _edata." (https://docs.oracle.com/cd/E53394_01/html/E54766/u-etext-3c.html).
     12 ## 3) Address of _end is different from _edata because of 2.
     13 ## 4) Addresses of _edata == edata, _end == end and _etext == etext.
     14 # CHECK:      Sections:
     15 # CHECK-NEXT:  Idx Name          Size      Address          Type
     16 # CHECK-NEXT:    0               00000000 0000000000000000
     17 # CHECK-NEXT:    1 .text         00000001 0000000000201000 TEXT
     18 # CHECK-NEXT:    2 .data         00000002 0000000000202000 DATA
     19 # CHECK-NEXT:    3 .bss          00000006 0000000000202004 BSS
     20 # CHECK:      SYMBOL TABLE:
     21 # CHECK-NEXT:  0000000000000000         *UND* 00000000
     22 # CHECK-NEXT:  0000000000202002         .data 00000000 _edata
     23 # CHECK-NEXT:  000000000020200a         .bss  00000000 _end
     24 # CHECK-NEXT:  0000000000201001         .text 00000000 _etext
     25 # CHECK-NEXT:  0000000000201000         .text 00000000 _start
     26 # CHECK-NEXT:  0000000000202002         .data 00000000 edata
     27 # CHECK-NEXT:  000000000020200a         .bss  00000000 end
     28 # CHECK-NEXT:  0000000000201001         .text 00000000 etext
     29 
     30 # RUN: ld.lld -r %t.o -o %t2
     31 # RUN: llvm-objdump -t %t2 | FileCheck %s --check-prefix=RELOCATABLE
     32 # RELOCATABLE:       0000000000000000 *UND* 00000000 _edata
     33 # RELOCATABLE-NEXT:  0000000000000000 *UND* 00000000 _end
     34 # RELOCATABLE-NEXT:  0000000000000000 *UND* 00000000 _etext
     35 
     36 .global _start,_end,_etext,_edata,end,etext,edata
     37 .text
     38 _start:
     39   nop
     40 .data
     41   .word 1
     42 .bss
     43   .align 4
     44   .space 6