brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.0 KiB · e4611e4 Raw
163 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/symbol-ordering-file-warnings1.s -o %t2.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/symbol-ordering-file-warnings2.s -o %t3.o5# RUN: ld.lld -shared %t2.o -o %t.so6 7# Check that a warning is emitted for entries in the file that are not present in any used input.8# RUN: echo "missing" > %t-order-missing.txt9# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-missing.txt \10# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,MISSING11 12# Check that the warning can be disabled.13# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-missing.txt \14# RUN:   --unresolved-symbols=ignore-all --no-warn-symbol-ordering 2>&1 | \15# RUN:   FileCheck %s --check-prefixes=WARN --allow-empty16 17# Check that the warning can be re-enabled18# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-missing.txt \19# RUN:   --unresolved-symbols=ignore-all --no-warn-symbol-ordering --warn-symbol-ordering 2>&1 | \20# RUN:   FileCheck %s --check-prefixes=WARN,MISSING21 22# Check that a warning is emitted for imported shared symbols.23# RUN: echo "shared" > %t-order-shared.txt24# RUN: ld.lld %t1.o %t.so -o %t --symbol-ordering-file %t-order-shared.txt \25# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,SHARED26 27# Check that a warning is emitted for absolute symbols.28# RUN: echo "absolute" > %t-order-absolute.txt29# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-absolute.txt \30# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,ABSOLUTE31 32# Check that a warning is emitted for symbols discarded due to --gc-sections.33# RUN: echo "gc" > %t-order-gc.txt34# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-gc.txt --gc-sections \35# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,GC36 37# Check that a warning is not emitted for the symbol removed due to --icf.38# RUN: echo "icf1" > %t-order-icf.txt39# RUN: echo "icf2" >> %t-order-icf.txt40# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-icf.txt --icf=all \41# RUN:   --unresolved-symbols=ignore-all --fatal-warnings42 43# RUN: echo "_GLOBAL_OFFSET_TABLE_" > %t-order-synthetic.txt44# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-synthetic.txt --icf=all \45# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,SYNTHETIC46 47# Check that a warning is emitted for symbols discarded due to a linker script /DISCARD/ section.48# RUN: echo "discard" > %t-order-discard.txt49# RUN: echo "SECTIONS { /DISCARD/ : { *(.text.discard) } }" > %t.script50# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-discard.txt -T %t.script \51# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,DISCARD52 53# Check that LLD does not warn for discarded COMDAT symbols, if they are present in the kept instance.54# RUN: echo "comdat" > %t-order-comdat.txt55# RUN: ld.lld %t1.o %t2.o -o %t --symbol-ordering-file %t-order-comdat.txt \56# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN --allow-empty57 58# Check that if a COMDAT was unused and discarded via --gc-sections, warn for each instance.59# RUN: ld.lld %t1.o %t2.o -o %t --symbol-ordering-file %t-order-comdat.txt --gc-sections \60# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,COMDAT61 62# Check that if a weak symbol is not kept, because of an equivalent global symbol, no warning is emitted.63# RUN: echo "glob_or_wk" > %t-order-weak.txt64# RUN: ld.lld %t1.o %t2.o -o %t --symbol-ordering-file %t-order-weak.txt \65# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN --allow-empty66 67# Check that symbols only in unused archive members does not result in a warning.68# RUN: rm -f %t.a69# RUN: llvm-ar rc %t.a %t3.o70# RUN: ld.lld %t1.o %t.a -o %t --symbol-ordering-file %t-order-missing.txt \71# RUN:   --unresolved-symbols=ignore-all 2>&1 | count 072 73# Check that a warning for each same-named symbol with an issue.74# RUN: echo "multi" > %t-order-same-name.txt75# RUN: ld.lld %t1.o %t2.o %t3.o -o %t --symbol-ordering-file %t-order-same-name.txt \76# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,MULTI77 78# Check that a warning is emitted if the same symbol is mentioned multiple times in the ordering file.79# RUN: echo "_start" > %t-order-multiple-same.txt80# RUN: echo "_start" >> %t-order-multiple-same.txt81# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-multiple-same.txt \82# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,SAMESYM83 84# Check that all warnings can be emitted from the same input.85# RUN: echo "missing_sym" > %t-order-multi.txt86# RUN: echo "undefined" >> %t-order-multi.txt87# RUN: echo "_start" >> %t-order-multi.txt88# RUN: echo "shared" >> %t-order-multi.txt89# RUN: echo "absolute" >> %t-order-multi.txt90# RUN: echo "gc" >> %t-order-multi.txt91# RUN: echo "discard" >> %t-order-multi.txt92# RUN: echo "_GLOBAL_OFFSET_TABLE_" >> %t-order-multi.txt93# RUN: echo "_start" >> %t-order-multi.txt94# RUN: ld.lld %t1.o %t3.o %t.so -o %t --symbol-ordering-file %t-order-multi.txt --gc-sections -T %t.script \95# RUN:   2>&1 | FileCheck %s --check-prefixes=WARN,SAMESYM,ABSOLUTE,SHARED,UNDEFINED,GC,DISCARD,MISSING2,SYNTHETIC96 97# WARN-NOT:    warning:98# SAMESYM:     warning: {{.*}}.txt: duplicate ordered symbol: _start99# WARN-NOT:    warning:100# SHARED:      warning: {{.*}}.so: unable to order shared symbol: shared101# WARN-NOT:    warning:102# DISCARD:     warning: {{.*}}1.o: unable to order discarded symbol: discard103# WARN-NOT:    warning:104# GC:          warning: {{.*}}1.o: unable to order discarded symbol: gc105# WARN-NOT:    warning:106# SYNTHETIC:   warning: <internal>: unable to order synthetic symbol: _GLOBAL_OFFSET_TABLE_107# WARN-NOT:    warning:108# UNDEFINED:   warning: {{.*}}3.o: unable to order undefined symbol: undefined109# WARN-NOT:    warning:110# ABSOLUTE:    warning: {{.*}}1.o: unable to order absolute symbol: absolute111# WARN-NOT:    warning:112# MISSING:     warning: symbol ordering file: no such symbol: missing113# WARN-NOT:    warning:114# MISSING2:    warning: symbol ordering file: no such symbol: missing_sym115# WARN-NOT:    warning:116# COMDAT:      warning: {{.*}}1.o: unable to order discarded symbol: comdat117# WARN-NOT:    warning:118# MULTI:       warning: {{.*}}2.o: unable to order absolute symbol: multi119# WARN-NOT:    warning:120 121.section .text._start,"ax",@progbits122.global _start123_start:124  movq  %rax, absolute125  callq shared126 127absolute = 0x1234128 129.section .text.comdat,"axG",@progbits,comdat,comdat130.weak comdat131comdat:132  nop133 134.section .text.discard,"ax",@progbits135.global discard136discard:137  nop138 139.section .text.gc,"ax",@progbits140.global gc141gc:142  nop143 144.section .text.glob_or_wk,"ax",@progbits145.weak glob_or_wk146glob_or_wk:147  nop148 149.section .text.icf1,"ax",@progbits150.global icf1151icf1:152    ret153 154.section .text.icf2,"ax",@progbits155.global icf2156icf2:157    ret158 159# This is a "good" instance of the symbol160.section .text.multi,"ax",@progbits161multi:162  .quad _GLOBAL_OFFSET_TABLE_163