brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · eb409cc Raw
56 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o3# RUN: ld.lld -o %t %t.o --defsym=foo2=foo14# RUN: llvm-readelf -s %t | FileCheck %s5# RUN: llvm-objdump -d --print-imm-hex %t | FileCheck %s --check-prefix=USE6 7## Check that we accept --defsym foo2=foo1 form.8# RUN: ld.lld -o %t2 %t.o --defsym '"foo2"=foo1'9# RUN: llvm-readelf -s %t2 | FileCheck %s10# RUN: llvm-objdump -d --print-imm-hex %t2 | FileCheck %s --check-prefix=USE11 12## Check we are reporting the error correctly and don't crash13## when handling the second --defsym.14# RUN: not ld.lld -o /dev/null %t.o --defsym ERR+ --defsym foo2=foo1 2>&1 | FileCheck %s --check-prefix=ERR --strict-whitespace15#      ERR:error: --defsym:1: = expected, but got +16# ERR-NEXT:>>> ERR+17# ERR-NEXT:>>>    ^18 19# CHECK-DAG: 0000000000000123     0 NOTYPE  GLOBAL DEFAULT   ABS foo120# CHECK-DAG: 0000000000000123     0 NOTYPE  GLOBAL DEFAULT   ABS foo221 22## Check we can use foo2 and it that it is an alias for foo1.23# USE:       Disassembly of section .text:24# USE-EMPTY:25# USE-NEXT:  <_start>:26# USE-NEXT:    movl $0x123, %edx27 28# RUN: ld.lld -o %t %t.o --defsym=foo2=129# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=ABS30 31# ABS: 0000000000000001     0 NOTYPE  GLOBAL DEFAULT   ABS foo232 33# RUN: ld.lld -o %t %t.o --defsym=foo2=foo1+534# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=EXPR35 36# EXPR-DAG: 0000000000000123     0 NOTYPE  GLOBAL DEFAULT   ABS foo137# EXPR-DAG: 0000000000000128     0 NOTYPE  GLOBAL DEFAULT   ABS foo238 39# RUN: not ld.lld -o /dev/null %t.o --defsym=foo2=und 2>&1 | FileCheck %s -check-prefix=ERR140# ERR1: error: --defsym:1: symbol not found: und41 42# RUN: not ld.lld -o /dev/null %t.o --defsym=xxx=yyy,zzz 2>&1 | FileCheck %s -check-prefix=ERR243# ERR2: error: --defsym:1: EOF expected, but got ,44 45# RUN: not ld.lld -o /dev/null %t.o --defsym=foo 2>&1 | FileCheck %s -check-prefix=ERR346# ERR3: error: --defsym:1: unexpected EOF47 48# RUN: not ld.lld -o /dev/null %t.o --defsym= 2>&1 | FileCheck %s -check-prefix=ERR349 50.globl foo151 foo1 = 0x12352 53.global _start54_start:55  movl $foo2, %edx56