mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-29 16:05:28 +00:00
llvm-ar: add some tests for llvm-ar default selection
This adds some tests for the smarter llvm-ar selection mode as well as some additional tests as per Rafael's post commit review comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273768 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a9bf312be4
commit
005f32a475
55
test/tools/llvm-ar/Inputs/coff.yaml
Normal file
55
test/tools/llvm-ar/Inputs/coff.yaml
Normal file
@ -0,0 +1,55 @@
|
||||
---
|
||||
header:
|
||||
Machine: IMAGE_FILE_MACHINE_AMD64
|
||||
Characteristics: [ ]
|
||||
sections:
|
||||
- Name: .text
|
||||
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
||||
Alignment: 4
|
||||
SectionData: ''
|
||||
- Name: .data
|
||||
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
|
||||
Alignment: 4
|
||||
SectionData: ''
|
||||
- Name: .bss
|
||||
Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
|
||||
Alignment: 4
|
||||
SectionData: ''
|
||||
symbols:
|
||||
- Name: .text
|
||||
Value: 0
|
||||
SectionNumber: 1
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
SectionDefinition:
|
||||
Length: 0
|
||||
NumberOfRelocations: 0
|
||||
NumberOfLinenumbers: 0
|
||||
CheckSum: 0
|
||||
Number: 1
|
||||
- Name: .data
|
||||
Value: 0
|
||||
SectionNumber: 2
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
SectionDefinition:
|
||||
Length: 0
|
||||
NumberOfRelocations: 0
|
||||
NumberOfLinenumbers: 0
|
||||
CheckSum: 0
|
||||
Number: 2
|
||||
- Name: .bss
|
||||
Value: 0
|
||||
SectionNumber: 3
|
||||
SimpleType: IMAGE_SYM_TYPE_NULL
|
||||
ComplexType: IMAGE_SYM_DTYPE_NULL
|
||||
StorageClass: IMAGE_SYM_CLASS_STATIC
|
||||
SectionDefinition:
|
||||
Length: 0
|
||||
NumberOfRelocations: 0
|
||||
NumberOfLinenumbers: 0
|
||||
CheckSum: 0
|
||||
Number: 3
|
||||
...
|
26
test/tools/llvm-ar/Inputs/elf.yaml
Normal file
26
test/tools/llvm-ar/Inputs/elf.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .text
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
||||
AddressAlign: 0x0000000000000004
|
||||
Content: ''
|
||||
- Name: .comment
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_MERGE, SHF_STRINGS ]
|
||||
AddressAlign: 0x0000000000000001
|
||||
Content: 00636C616E672076657273696F6E20332E392E3020287472756E6B203237333632342920286C6C766D2F7472756E6B203237333633362900
|
||||
- Name: .note.GNU-stack
|
||||
Type: SHT_PROGBITS
|
||||
AddressAlign: 0x0000000000000001
|
||||
Content: ''
|
||||
Symbols:
|
||||
Local:
|
||||
- Name: '-'
|
||||
Type: STT_FILE
|
||||
...
|
45
test/tools/llvm-ar/Inputs/macho.yaml
Normal file
45
test/tools/llvm-ar/Inputs/macho.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
--- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x01000007
|
||||
cpusubtype: 0x00000003
|
||||
filetype: 0x00000001
|
||||
ncmds: 1
|
||||
sizeofcmds: 152
|
||||
flags: 0x00002000
|
||||
reserved: 0x00000000
|
||||
LoadCommands:
|
||||
- cmd: LC_SEGMENT_64
|
||||
cmdsize: 152
|
||||
segname: ''
|
||||
vmaddr: 0
|
||||
vmsize: 0
|
||||
fileoff: 184
|
||||
filesize: 0
|
||||
maxprot: 7
|
||||
initprot: 7
|
||||
nsects: 1
|
||||
flags: 0
|
||||
Sections:
|
||||
- sectname: __text
|
||||
segname: __TEXT
|
||||
addr: 0x0000000000000000
|
||||
size: 0
|
||||
offset: 0x000000B8
|
||||
align: 0
|
||||
reloff: 0x00000000
|
||||
nreloc: 0
|
||||
flags: 0x80000000
|
||||
reserved1: 0x00000000
|
||||
reserved2: 0x00000000
|
||||
reserved3: 0x00000000
|
||||
LinkEditData:
|
||||
ExportTrie:
|
||||
TerminalSize: 0
|
||||
NodeOffset: 0
|
||||
Name: ''
|
||||
Flags: 0x0000000000000000
|
||||
Address: 0x0000000000000000
|
||||
Other: 0x0000000000000000
|
||||
ImportName: ''
|
||||
...
|
17
test/tools/llvm-ar/default-add.test
Normal file
17
test/tools/llvm-ar/default-add.test
Normal file
@ -0,0 +1,17 @@
|
||||
RUN: yaml2obj -format macho %S/Inputs/macho.yaml -o %t-macho.o
|
||||
RUN: yaml2obj -format coff %S/Inputs/coff.yaml -o %t-coff.o
|
||||
|
||||
RUN: rm -f %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t-macho.o
|
||||
RUN: grep -q __.SYMDEF %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t-coff.o
|
||||
RUN: grep -q __.SYMDEF %t.ar
|
||||
|
||||
RUN: rm -f %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t-coff.o
|
||||
RUN: not grep -q __.SYMDEF %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t-macho.o
|
||||
RUN: not grep -q __.SYMDEF %t.ar
|
||||
|
||||
Ensure that we select the existing format when updating.
|
||||
|
10
test/tools/llvm-ar/default-coff.test
Normal file
10
test/tools/llvm-ar/default-coff.test
Normal file
@ -0,0 +1,10 @@
|
||||
RUN: yaml2obj -format coff %S/Inputs/coff.yaml -o %t.obj
|
||||
|
||||
RUN: rm -f %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t.obj
|
||||
RUN: not grep -q __.SYMDEF %t.ar
|
||||
|
||||
Ensure that we generate a GNU style archive for COFF by default. The GNU linker
|
||||
expects that it will be in GNU format. The lib format on Windows is compatible
|
||||
with the GNU format.
|
||||
|
9
test/tools/llvm-ar/default-elf.test
Normal file
9
test/tools/llvm-ar/default-elf.test
Normal file
@ -0,0 +1,9 @@
|
||||
RUN: yaml2obj -format elf %S/Inputs/elf.yaml -o %t.o
|
||||
|
||||
RUN: rm -f %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t.o
|
||||
RUN: not grep -q __.SYMDEF %t.ar
|
||||
|
||||
Ensure that we generate a GNU style archive for ELF by default. The GNU linker
|
||||
expects that it will be in GNU format.
|
||||
|
9
test/tools/llvm-ar/default-macho.test
Normal file
9
test/tools/llvm-ar/default-macho.test
Normal file
@ -0,0 +1,9 @@
|
||||
RUN: yaml2obj -format macho %S/Inputs/macho.yaml -o %t.o
|
||||
|
||||
RUN: rm -f %t.ar
|
||||
RUN: llvm-ar crs %t.ar %t.o
|
||||
RUN: grep -q __.SYMDEF %t.ar
|
||||
|
||||
Ensure that we generate a BSD style archive for MachO by default. ld64 expects
|
||||
that it will be in BSD format.
|
||||
|
8
test/tools/llvm-ar/override.test
Normal file
8
test/tools/llvm-ar/override.test
Normal file
@ -0,0 +1,8 @@
|
||||
RUN: yaml2obj -format macho %S/Inputs/macho.yaml -o %t.o
|
||||
|
||||
RUN: rm -f %t.ar
|
||||
RUN: llvm-ar -format gnu crs %t.ar %t.o
|
||||
RUN: not grep -q __.SYMDEF %t.ar
|
||||
|
||||
Ensure that we honour a specific request
|
||||
|
Loading…
Reference in New Issue
Block a user