[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / avr-thunk-ldi-gs.s
blob58de33780ba1e316d7faec5149089077859fa305
1 ; REQUIRES: avr
2 ; RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega2560 %s -o %t.o
3 ; RUN: ld.lld %t.o --defsym=a=0x1fffe --defsym=b=0x20000 -o %t
4 ; RUN: llvm-objdump -d --print-imm-hex --no-show-raw-insn --mcpu=atmega2560 %t \
5 ; RUN: | FileCheck %s
7 .section .LDI,"ax",@progbits
9 ;; CHECK-LABEL: <__AVRThunk_b>:
10 ;; CHECK-NEXT: 110b4: jmp 0x20000
11 ;; CHECK-LABEL: <__init>:
12 ;; CHECK-NEXT: 110b8: ldi r30, 0xff
13 ;; CHECK-NEXT: 110ba: ldi r31, 0xff
14 ;; CHECK-NEXT: 110bc: eicall
15 ;; The destination of the following two LDI instructions is
16 ;; __AVRThunk_b == 0x110b4, so they actually are
17 ;; ldi r30, ((0x110b4) >> 1) & 0xff
18 ;; ldi r31, ((0x110b4) >> 9)
19 ;; CHECK-NEXT: 110be: ldi r30, 0x5a
20 ;; CHECK-NEXT: 110c0: ldi r31, 0x88
21 ;; CHECK-NEXT: 110c2: eicall
22 ;; CHECK-NOT: __AVRThunk_a
24 .globl __init
25 __init:
26 ;; No thunk is needed, since the destination is in range [0, 0x1ffff].
27 ldi r30, lo8_gs(a) ; R_AVR_LO8_LDI_GS
28 ldi r31, hi8_gs(a) ; R_AVR_HI8_LDI_GS
29 eicall
30 ;; A thunk is needed, since the destination is out of range.
31 ldi r30, lo8_gs(b) ; R_AVR_LO8_LDI_GS
32 ldi r31, hi8_gs(b) ; R_AVR_HI8_LDI_GS
33 eicall