brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 1009b7a Raw
163 lines · plain
1// REQUIRES: x862// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o3// RUN: echo "SECTIONS { . = SIZEOF_HEADERS; .text : { *(.text) } }" > %t.script4// RUN: ld.lld -T %t.script %t.o -o %t5// RUN: llvm-readobj --symbols %t | FileCheck %s6 7// Test that _start is in the correct section.8// CHECK:      Name: _start9// CHECK-NEXT: Value:10// CHECK-NEXT: Size: 011// CHECK-NEXT: Binding: Global12// CHECK-NEXT: Type: None13// CHECK-NEXT: Other: 014// CHECK-NEXT: Section: dn15 16// Show that --gc-sections works when there are many sections, and that17// referenced common and absolute symbols in such cases are not removed, nor are18// they incorrectly attributed to the sections with index 0xFFF1 or 0xFFF2.19// RUN: ld.lld %t.o -T %t.script -o %t --gc-sections20// RUN: llvm-readobj --symbols --sections %t | FileCheck %s --check-prefix=GC21 22// GC:      Sections [23// GC-NEXT:   Section {24// GC-NEXT:     Index: 025// GC-NEXT:     Name:  (0)26// GC:        Section {27// GC-NEXT:     Index: 128// GC-NEXT:     Name: dn29// GC:        Section {30// GC-NEXT:     Index: 231// GC-NEXT:     Name: .bss32// GC:        Section {33// GC-NEXT:     Index: 334// GC-NEXT:     Name: .comment35// GC:        Section {36// GC-NEXT:     Index: 437// GC-NEXT:     Name: .symtab38// GC:        Section {39// GC-NEXT:     Index: 540// GC-NEXT:     Name: .shstrtab41// GC:        Section {42// GC-NEXT:     Index: 643// GC-NEXT:     Name: .strtab44// GC-NOT:    Section {45 46// GC:      Symbols [47// GC-NEXT:   Symbol {48// GC-NEXT:     Name:  (0)49// GC:        Symbol {50// GC-NEXT:     Name: sdn51// GC:        Symbol {52// GC-NEXT:     Name: abs53// GC:        Symbol {54// GC-NEXT:     Name: common55// GC:        Symbol {56// GC-NEXT:     Name: _start57// GC-NOT:    Symbol {58 59.macro gen_sections4 x60        .section a\x,"a"61        .global sa\x62        sa\x:63        .section b\x,"a"64        .global sa\x65        sb\x:66        .section c\x,"a"67        .global sa\x68        sc\x:69        .section d\x,"a"70        .global sa\x71        sd\x:72.endm73 74.macro gen_sections8 x75        gen_sections4 a\x76        gen_sections4 b\x77.endm78 79.macro gen_sections16 x80        gen_sections8 a\x81        gen_sections8 b\x82.endm83 84.macro gen_sections32 x85        gen_sections16 a\x86        gen_sections16 b\x87.endm88 89.macro gen_sections64 x90        gen_sections32 a\x91        gen_sections32 b\x92.endm93 94.macro gen_sections128 x95        gen_sections64 a\x96        gen_sections64 b\x97.endm98 99.macro gen_sections256 x100        gen_sections128 a\x101        gen_sections128 b\x102.endm103 104.macro gen_sections512 x105        gen_sections256 a\x106        gen_sections256 b\x107.endm108 109.macro gen_sections1024 x110        gen_sections512 a\x111        gen_sections512 b\x112.endm113 114.macro gen_sections2048 x115        gen_sections1024 a\x116        gen_sections1024 b\x117.endm118 119.macro gen_sections4096 x120        gen_sections2048 a\x121        gen_sections2048 b\x122.endm123 124.macro gen_sections8192 x125        gen_sections4096 a\x126        gen_sections4096 b\x127.endm128 129.macro gen_sections16384 x130        gen_sections8192 a\x131        gen_sections8192 b\x132.endm133 134.macro gen_sections32768 x135        gen_sections16384 a\x136        gen_sections16384 b\x137.endm138 139gen_sections32768 a140gen_sections16384 b141gen_sections8192 c142gen_sections4096 d143gen_sections2048 e144gen_sections1024 f145gen_sections512 g146gen_sections256 h147gen_sections128 i148gen_sections64 j149gen_sections32 k150gen_sections16 l151gen_sections8 m152gen_sections4 n153 154.global abs155abs = 0x12345678156 157.comm common,4,4158 159.global _start160_start:161  .quad abs162  .quad common163