1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01: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.

llvm-svn: 273768
This commit is contained in:
Saleem Abdulrasool 2016-06-25 03:05:56 +00:00
parent 6f6c5e3749
commit 33db772703
8 changed files with 179 additions and 0 deletions

View 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
...

View 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
...

View 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: ''
...

View 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.

View 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.

View 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.

View 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.

View 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