Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply [llvm-lipo] Implement -create (with hardcoded alignments)
This reapplies r366142 with a fix for the failing Windows test. Original commit message: Creates universal binary output file from input files. Currently uses hard coded value for alignment. Want to get the create functionality approved before implementing the alignment function. Patch by Anusha Basana <anusha.basana@gmail.com> Differential Revision: https://reviews.llvm.org/D64102 llvm-svn: 366512
- Loading branch information
Showing
8 changed files
with
528 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- !mach-o | ||
FileHeader: | ||
magic: 0xFEEDFACF | ||
cputype: 0x0100000C | ||
cpusubtype: 0x00000000 | ||
filetype: 0x00000001 | ||
ncmds: 4 | ||
sizeofcmds: 352 | ||
flags: 0x00002000 | ||
reserved: 0x00000000 | ||
LoadCommands: | ||
- cmd: LC_SEGMENT_64 | ||
cmdsize: 232 | ||
segname: '' | ||
vmaddr: 0 | ||
vmsize: 56 | ||
fileoff: 384 | ||
filesize: 56 | ||
maxprot: 7 | ||
initprot: 7 | ||
nsects: 2 | ||
flags: 0 | ||
Sections: | ||
- sectname: __text | ||
segname: __TEXT | ||
addr: 0x0000000000000000 | ||
size: 20 | ||
offset: 0x00000180 | ||
align: 2 | ||
reloff: 0x00000000 | ||
nreloc: 0 | ||
flags: 0x80000400 | ||
reserved1: 0x00000000 | ||
reserved2: 0x00000000 | ||
reserved3: 0x00000000 | ||
- sectname: __compact_unwind | ||
segname: __LD | ||
addr: 0x0000000000000018 | ||
size: 32 | ||
offset: 0x00000198 | ||
align: 3 | ||
reloff: 0x000001B8 | ||
nreloc: 1 | ||
flags: 0x02000000 | ||
reserved1: 0x00000000 | ||
reserved2: 0x00000000 | ||
reserved3: 0x00000000 | ||
- cmd: LC_VERSION_MIN_IPHONEOS | ||
cmdsize: 16 | ||
version: 327680 | ||
sdk: 0 | ||
- cmd: LC_SYMTAB | ||
cmdsize: 24 | ||
symoff: 448 | ||
nsyms: 3 | ||
stroff: 496 | ||
strsize: 20 | ||
- cmd: LC_DYSYMTAB | ||
cmdsize: 80 | ||
ilocalsym: 0 | ||
nlocalsym: 2 | ||
iextdefsym: 2 | ||
nextdefsym: 1 | ||
iundefsym: 3 | ||
nundefsym: 0 | ||
tocoff: 0 | ||
ntoc: 0 | ||
modtaboff: 0 | ||
nmodtab: 0 | ||
extrefsymoff: 0 | ||
nextrefsyms: 0 | ||
indirectsymoff: 0 | ||
nindirectsyms: 0 | ||
extreloff: 0 | ||
nextrel: 0 | ||
locreloff: 0 | ||
nlocrel: 0 | ||
LinkEditData: | ||
NameList: | ||
- n_strx: 13 | ||
n_type: 0x0E | ||
n_sect: 1 | ||
n_desc: 0 | ||
n_value: 0 | ||
- n_strx: 7 | ||
n_type: 0x0E | ||
n_sect: 2 | ||
n_desc: 0 | ||
n_value: 24 | ||
- n_strx: 1 | ||
n_type: 0x0F | ||
n_sect: 1 | ||
n_desc: 0 | ||
n_value: 0 | ||
StringTable: | ||
- '' | ||
- _main | ||
- ltmp1 | ||
- ltmp0 | ||
- '' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- !mach-o | ||
FileHeader: | ||
magic: 0xFEEDFACE | ||
cputype: 0x0000000C | ||
cpusubtype: 0x00000009 | ||
filetype: 0x00000001 | ||
ncmds: 4 | ||
sizeofcmds: 244 | ||
flags: 0x00002000 | ||
LoadCommands: | ||
- cmd: LC_SEGMENT | ||
cmdsize: 124 | ||
segname: '' | ||
vmaddr: 0 | ||
vmsize: 10 | ||
fileoff: 272 | ||
filesize: 10 | ||
maxprot: 7 | ||
initprot: 7 | ||
nsects: 1 | ||
flags: 0 | ||
Sections: | ||
- sectname: __text | ||
segname: __TEXT | ||
addr: 0x0000000000000000 | ||
size: 10 | ||
offset: 0x00000110 | ||
align: 1 | ||
reloff: 0x00000000 | ||
nreloc: 0 | ||
flags: 0x80000400 | ||
reserved1: 0x00000000 | ||
reserved2: 0x00000000 | ||
reserved3: 0x00000000 | ||
- cmd: LC_VERSION_MIN_IPHONEOS | ||
cmdsize: 16 | ||
version: 327680 | ||
sdk: 0 | ||
- cmd: LC_SYMTAB | ||
cmdsize: 24 | ||
symoff: 284 | ||
nsyms: 1 | ||
stroff: 296 | ||
strsize: 8 | ||
- cmd: LC_DYSYMTAB | ||
cmdsize: 80 | ||
ilocalsym: 0 | ||
nlocalsym: 0 | ||
iextdefsym: 0 | ||
nextdefsym: 1 | ||
iundefsym: 1 | ||
nundefsym: 0 | ||
tocoff: 0 | ||
ntoc: 0 | ||
modtaboff: 0 | ||
nmodtab: 0 | ||
extrefsymoff: 0 | ||
nextrefsyms: 0 | ||
indirectsymoff: 0 | ||
nindirectsyms: 0 | ||
extreloff: 0 | ||
nextrel: 0 | ||
locreloff: 0 | ||
nlocrel: 0 | ||
LinkEditData: | ||
NameList: | ||
- n_strx: 1 | ||
n_type: 0x0F | ||
n_sect: 1 | ||
n_desc: 8 | ||
n_value: 0 | ||
StringTable: | ||
- '' | ||
- _main | ||
- '' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- !mach-o | ||
FileHeader: | ||
magic: 0xFEEDFACF | ||
cputype: 0x01000007 | ||
cpusubtype: 0x00000003 | ||
filetype: 0x00000001 | ||
ncmds: 4 | ||
sizeofcmds: 352 | ||
flags: 0x00002000 | ||
reserved: 0x00000000 | ||
LoadCommands: | ||
- cmd: LC_SEGMENT_64 | ||
cmdsize: 232 | ||
segname: '' | ||
vmaddr: 0 | ||
vmsize: 80 | ||
fileoff: 384 | ||
filesize: 80 | ||
maxprot: 7 | ||
initprot: 7 | ||
nsects: 2 | ||
flags: 0 | ||
Sections: | ||
- sectname: __text | ||
segname: __TEXT | ||
addr: 0x0000000000000000 | ||
size: 15 | ||
offset: 0x00000180 | ||
align: 4 | ||
reloff: 0x00000000 | ||
nreloc: 0 | ||
flags: 0x80000400 | ||
reserved1: 0x00000000 | ||
reserved2: 0x00000000 | ||
reserved3: 0x00000000 | ||
- sectname: __eh_frame | ||
segname: __TEXT | ||
addr: 0x0000000000000010 | ||
size: 64 | ||
offset: 0x00000190 | ||
align: 3 | ||
reloff: 0x00000000 | ||
nreloc: 0 | ||
flags: 0x6800000B | ||
reserved1: 0x00000000 | ||
reserved2: 0x00000000 | ||
reserved3: 0x00000000 | ||
- cmd: LC_VERSION_MIN_MACOSX | ||
cmdsize: 16 | ||
version: 656384 | ||
sdk: 0 | ||
- cmd: LC_SYMTAB | ||
cmdsize: 24 | ||
symoff: 464 | ||
nsyms: 1 | ||
stroff: 480 | ||
strsize: 8 | ||
- cmd: LC_DYSYMTAB | ||
cmdsize: 80 | ||
ilocalsym: 0 | ||
nlocalsym: 0 | ||
iextdefsym: 0 | ||
nextdefsym: 1 | ||
iundefsym: 1 | ||
nundefsym: 0 | ||
tocoff: 0 | ||
ntoc: 0 | ||
modtaboff: 0 | ||
nmodtab: 0 | ||
extrefsymoff: 0 | ||
nextrefsyms: 0 | ||
indirectsymoff: 0 | ||
nindirectsyms: 0 | ||
extreloff: 0 | ||
nextrel: 0 | ||
locreloff: 0 | ||
nlocrel: 0 | ||
LinkEditData: | ||
NameList: | ||
- n_strx: 1 | ||
n_type: 0x0F | ||
n_sect: 1 | ||
n_desc: 0 | ||
n_value: 0 | ||
StringTable: | ||
- '' | ||
- _main | ||
- '' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Executable testing is not supported on Windows, since all files are considered executable | ||
# UNSUPPORTED: system-windows | ||
# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o | ||
# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o | ||
|
||
# RUN: chmod -x %t-i386.o | ||
# RUN: chmod -x %t-x86_64.o | ||
# RUN: llvm-lipo %t-i386.o %t-x86_64.o -create -output %t-universal.o | ||
# RUN: test ! -x %t-universal.o | ||
|
||
# RUN: chmod +x %t-i386.o | ||
# RUN: llvm-lipo %t-i386.o %t-x86_64.o -create -output %t-universal.o | ||
# RUN: test -x %t-universal.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-32.o | ||
# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o | ||
|
||
# RUN: not llvm-lipo %t-32.o -create 2>&1 | FileCheck --check-prefix=NO_OUTPUT %s | ||
# NO_OUTPUT: error: create expects a single output file to be specified | ||
|
||
# RUN: not llvm-lipo %t-universal.o %t-32.o -create -output %t.o 2>&1 | FileCheck --check-prefix=DUPLICATE_ARCHS %s | ||
# DUPLICATE_ARCHS: have the same architecture i386 and therefore cannot be in the same universal binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# RUN: yaml2obj %p/Inputs/i386-slice.yaml > %t-i386.o | ||
# RUN: yaml2obj %p/Inputs/x86_64-slice.yaml > %t-x86_64.o | ||
|
||
# RUN: llvm-lipo %t-i386.o %t-x86_64.o -create -output %t-universal-llvm.o | ||
|
||
# RUN: yaml2obj %p/Inputs/i386-x86_64-universal.yaml > %t-universal.o | ||
# RUN: cmp %t-universal-llvm.o %t-universal.o | ||
|
||
# RUN: yaml2obj %p/Inputs/armv7-slice.yaml > %t-armv7.o | ||
# RUN: yaml2obj %p/Inputs/arm64-slice.yaml > %t-arm64.o | ||
|
||
# RUN: llvm-lipo %t-arm64.o %t-armv7.o %t-universal.o -create -output %t-universal-2.o | ||
# RUN: llvm-lipo %t-universal-2.o -thin x86_64 -output %t-x86_64_extracted.o | ||
# RUN: cmp %t-x86_64_extracted.o %t-x86_64.o | ||
# RUN: llvm-lipo %t-universal-2.o -thin armv7 -output %t-armv7-extracted.o | ||
# RUN: cmp %t-armv7-extracted.o %t-armv7.o | ||
|
||
# RUN: llvm-objdump %t-universal-2.o -m --universal-headers | FileCheck %s | ||
# CHECK: fat_magic FAT_MAGIC | ||
# CHECK: nfat_arch 4 | ||
# CHECK: architecture i386 | ||
# CHECK: offset 4096 | ||
# CHECK: align 2^12 (4096) | ||
# CHECK: architecture x86_64 | ||
# CHECK: offset 8192 | ||
# CHECK: align 2^12 (4096) | ||
# CHECK: architecture armv7 | ||
# CHECK: offset 16384 | ||
# CHECK: align 2^14 (16384) | ||
# CHECK: architecture arm64 | ||
# CHECK: offset 32768 | ||
# CHECK: align 2^14 (16384) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.