summaryrefslogtreecommitdiffstats
path: root/lld/test/old-elf/linkerscript/phdrs-invalid.test
blob: c1426e8ffa5fe0e4a83e78eca6580e3242bd32cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
This group of tests checks invalid cases of defining and using PHDRS
command in linker scripts.

This test uses a single X86-64 input object, simple.o, created with the
following X86-64 assembly code:

*** simple.S:

(command line clang -c simple.S -o simple.o)

      .text
      main:
        mov $1, %eax
        movq $1, %rdi
        movq $msg, %rsi
        movq $14, %rdx
        syscall
        ret

        .globl _start
      _start:
        call  main
        mov $60, %eax
        syscall
        ret

      .data
      msg: .asciz "Hello, World!\n"
*/

/*
Prepare the object file to test on.

RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o
*/

/*
Test undefined header used when no PHDRS defined.

RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-no-phdrs.script %t.o -static -o %t1 &> %t1-error
RUN: FileCheck -check-prefix UNDEF-NO-PHDRS %s < %t1-error

UNDEF-NO-PHDRS: Unknown header identifiers (missing in PHDRS command) are used
*/

/*
Test undefined header used when PHDRS is empty.

RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-empty-phdrs.script %t.o -static -o %t2 &> %t2-error
RUN: FileCheck -check-prefix UNDEF-EMPTY-PHDRS %s < %t2-error

UNDEF-EMPTY-PHDRS: Unknown header identifiers (missing in PHDRS command) are used
*/

/*
Test undefined header used when PHDRS contains definitions.

RUN: not lld -flavor old-gnu -target x86_64 -T %p/phdrs/undef-id-phdrs.script %t.o -static -o %t3 &> %t3-error
RUN: FileCheck -check-prefix UNDEF-ID-PHDRS %s < %t3-error

UNDEF-ID-PHDRS: Unknown header identifiers (missing in PHDRS command) are used
*/
OpenPOWER on IntegriCloud