92 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o3# RUN: ld.lld %t.o -o %t.out4# RUN: llvm-objdump -s %t.out| FileCheck %s --check-prefix=BEFORE5 6# BEFORE: Contents of section .foo:7# BEFORE-NEXT: 11223344 5566778# BEFORE: Contents of section .init:9# BEFORE-NEXT: 112210 11# RUN: echo "_foo4 " > %t_order.txt12# RUN: echo " _foo3" >> %t_order.txt13# RUN: echo "_nönascii" >> %t_order.txt14# RUN: echo "_foo5" >> %t_order.txt15# RUN: echo -e " _foo2 \t\v\r\f" >> %t_order.txt16# RUN: echo "# a comment" >> %t_order.txt17# RUN: echo " " >> %t_order.txt18# RUN: echo "_foo4" >> %t_order.txt19# RUN: echo "_bar1" >> %t_order.txt20# RUN: echo "" >> %t_order.txt21# RUN: echo "_foo1" >> %t_order.txt22# RUN: echo "_init2" >> %t_order.txt23# RUN: echo "_init1" >> %t_order.txt24 25## Show that both --symbol-ordering-file and --symbol-ordering-file= work.26## Also show that lines beginning with '#', whitespace and empty lines, are ignored.27## Also show that "first one wins" when there are duplicate symbols in the order28## file (a warning will be emitted).29# RUN: ld.lld --symbol-ordering-file %t_order.txt %t.o -o %t2.out 2>&1 | \30# RUN: FileCheck %s --check-prefix=WARN --implicit-check-not=warning:31# RUN: llvm-objdump -s %t2.out | FileCheck %s --check-prefix=AFTER32# RUN: ld.lld --symbol-ordering-file=%t_order.txt %t.o -o %t2.out33# RUN: llvm-objdump -s %t2.out | FileCheck %s --check-prefix=AFTER34 35# WARN: warning: {{.*}}.txt: duplicate ordered symbol36 37# AFTER: Contents of section .foo:38# AFTER-NEXT: 44337755 66221139# AFTER: Contents of section .init:40# AFTER-NEXT: 112241 42## Show that a nonexistent symbol ordering file causes an error.43# RUN: not ld.lld --symbol-ordering-file=%t.nonexistent %t.o -o %t3.out 2>&1 | \44# RUN: FileCheck -DMSG=%errc_ENOENT %s --check-prefix=ERR -DFILE=%t.nonexistent45 46# ERR: error: cannot open [[FILE]]: [[MSG]]47 48## Show that an empty ordering file can be handled (symbols remain in their49## normal order).50# RUN: touch %t.empty51# RUN: ld.lld --symbol-ordering-file=%t.empty %t.o -o %t4.out52# RUN: llvm-objdump -s %t4.out | FileCheck %s --check-prefix=BEFORE53 54.section .foo,"ax",@progbits,unique,155_foo1:56 .byte 0x1157 58.section .foo,"ax",@progbits,unique,259_foo2:60 .byte 0x2261 62.section .foo,"ax",@progbits,unique,363_foo3:64 .byte 0x3365 66.section .foo,"ax",@progbits,unique,467_foo4:68 .byte 0x4469 70.section .foo,"ax",@progbits,unique,571_foo5:72 .byte 0x5573_bar1:74 .byte 0x6675 76.section .foo,"ax",@progbits,unique,677"_nönascii":78.byte 0x7779 80.section .init,"ax",@progbits,unique,181_init1:82 .byte 0x1183 84.section .init,"ax",@progbits,unique,285_init2:86 .byte 0x2287 88.text89.global _start90_start:91 nop92