brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 0f6d2e4 Raw
45 lines · plain
1# REQUIRES: x862# RUN: split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/t.s -o %t.o4 5## PR52534: https://bugs.llvm.org/show_bug.cgi?id=525346## Check case where .preinit_array would be discarded in the absence of the7## start/stop symbols.8## Link should succeed without causing an out of range relocation error.9# RUN: ld.lld -T %t/discarded.script %t.o -o %t1 --image-base=0x8000000010# RUN: llvm-readelf -s %t1 | FileCheck --check-prefixes=CHECK,DISCARDED %s11 12## Check case where .preinit_array is emitted but empty.13# RUN: ld.lld -T %t/empty.script %t.o -o %t214# RUN: llvm-readelf -s %t2 | FileCheck --check-prefixes=CHECK,EMPTY %s15 16# CHECK:          [[#%x,ADDR:]] 0 NOTYPE  LOCAL  HIDDEN      [[#]] __preinit_array_start17# CHECK-NEXT:     [[#ADDR]]     0 NOTYPE  LOCAL  HIDDEN      [[#]] __preinit_array_end18 19# DISCARDED-NEXT: {{0*}}[[#ADDR-14]] 0 NOTYPE  GLOBAL DEFAULT     [[#]] _start20 21# EMPTY-NOT:      [[#ADDR]]     0 NOTYPE  GLOBAL DEFAULT     [[#]] _start22# EMPTY:          [[#ADDR]]     0 NOTYPE  GLOBAL DEFAULT     [[#]] ADDR23 24#--- t.s25.global _start26_start:27 movq __preinit_array_start@GOTPCREL(%rip),%rax28 movq __preinit_array_end@GOTPCREL(%rip),%rax29 30.section .rodata,"a"31.byte 032 33#--- discarded.script34SECTIONS {35  .rodata : { *(.rodata); }36  .text : { *(.text); }37  .preinit_array : { *(.preinit_array); }38}39 40#--- empty.script41SECTIONS {42  .text : { *(.text); }43  .preinit_array : { ADDR = .; *(.preinit_array); }44}45