Projects like libc use mutually exclusive macros to compile files multiple times and then merge the result into the final library. For installapi to accept these, we'd need to parse the same declarations in different ways. This patch adds the basic pipelining for installapi to create the correct TBD file. * -Xproject allows: -fmodules, -fobjc-arc, fvisibility=hidden, prefix headers * -Xlabel allows: -D and -U settings * Error on 'private' and 'public' labels -X<label> * Xplatform allows: -iframework <path> This is to support the case where zippered frameworks want to pass in iOSSupport search path.
287 lines
8.1 KiB
Plaintext
287 lines
8.1 KiB
Plaintext
; RUN: rm -rf %t
|
|
; RUN: split-file %s %t
|
|
; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json
|
|
; RUN: yaml2obj %t/Xplatform.yaml -o=%t/Xplatform
|
|
|
|
// Check that in zippered mode, a successful pass runs in both macos & maccatalyst.
|
|
; RUN: clang-installapi %t/inputs.json \
|
|
; RUN: --target=x86_64-apple-macos10.15 -darwin-target-variant x86_64-apple-ios13.1-macabi \
|
|
; RUN: -Xplatform_ios-macabi -iframework %t/System/iOSSupport/System/Library/Frameworks \
|
|
; RUN: -install_name /System/Library/Frameworks/Xplatform.framework/Versions/A/Xplatform \
|
|
; RUN: -fdefine-target-os-macros --verify-against=%t/Xplatform --verify-mode=Pedantic \
|
|
; RUN: -o Xplatform.tbd -F%t/Frameworks \
|
|
: RUN: -current_version 1 -compatibility_version 1 2>&1 | FileCheck --allow-empty %s\
|
|
; RUN: --implicit-check-not warning: --implicit-check-not error:
|
|
|
|
// A missing header error should be invoked in macos pass because it wasn't given the needed search path.
|
|
; RUN: mv %t/Xplatform-macosx.h %t/Frameworks/Xplatform.framework/Headers/Xplatform.h
|
|
|
|
; RUN: not clang-installapi %t/inputs.json \
|
|
; RUN: --target=x86_64-apple-macos10.15 -darwin-target-variant x86_64-apple-ios13.1-macabi \
|
|
; RUN: -Xplatform_ios-macabi -iframework %t/System/iOSSupport/System/Library/Frameworks \
|
|
; RUN: -install_name /System/Library/Frameworks/Xplatform.framework/Versions/A/Xplatform \
|
|
; RUN: -fdefine-target-os-macros --verify-against=%t/Xplatform --verify-mode=Pedantic \
|
|
; RUN: -o Xplatform.tbd -F%t/Frameworks \
|
|
: RUN: -current_version 1 -compatibility_version 1 2>&1 | FileCheck -check-prefix=MACOSFAIL %s
|
|
|
|
; MACOSFAIL: fatal error: 'IOSMac/IOSMac.h' file not found
|
|
|
|
;--- Frameworks/Xplatform.framework/Headers/Xplatform.h
|
|
#if TARGET_OS_MACCATALYST
|
|
#include <IOSMac/IOSMac.h>
|
|
#endif
|
|
|
|
inline int foo() {
|
|
int x = 1;
|
|
#if TARGET_OS_MACCATALYST
|
|
x += iOSAPI();
|
|
#endif
|
|
return x;
|
|
}
|
|
|
|
extern int bar();
|
|
|
|
;--- Xplatform-macosx.h
|
|
#include <IOSMac/IOSMac.h>
|
|
inline int foo() {
|
|
int x = 1;
|
|
return x;
|
|
}
|
|
|
|
extern int bar();
|
|
|
|
;--- System/iOSSupport/System/Library/Frameworks/IOSMac.framework/Headers/IOSMac.h
|
|
extern int iOSAPI();
|
|
|
|
;--- Xplatform.yaml
|
|
--- !mach-o
|
|
FileHeader:
|
|
magic: 0xFEEDFACF
|
|
cputype: 0x1000007
|
|
cpusubtype: 0x3
|
|
filetype: 0x6
|
|
ncmds: 16
|
|
sizeofcmds: 968
|
|
flags: 0x100085
|
|
reserved: 0x0
|
|
LoadCommands:
|
|
- cmd: LC_SEGMENT_64
|
|
cmdsize: 232
|
|
segname: __TEXT
|
|
vmaddr: 0
|
|
vmsize: 32768
|
|
fileoff: 0
|
|
filesize: 32768
|
|
maxprot: 5
|
|
initprot: 5
|
|
nsects: 2
|
|
flags: 0
|
|
Sections:
|
|
- sectname: __text
|
|
segname: __TEXT
|
|
addr: 0x4FAD
|
|
size: 11
|
|
offset: 0x4FAD
|
|
align: 0
|
|
reloff: 0x0
|
|
nreloc: 0
|
|
flags: 0x80000400
|
|
reserved1: 0x0
|
|
reserved2: 0x0
|
|
reserved3: 0x0
|
|
content: 554889E5B8010000005DC3
|
|
- sectname: __unwind_info
|
|
segname: __TEXT
|
|
addr: 0x4FB8
|
|
size: 72
|
|
offset: 0x4FB8
|
|
align: 2
|
|
reloff: 0x0
|
|
nreloc: 0
|
|
flags: 0x0
|
|
reserved1: 0x0
|
|
reserved2: 0x0
|
|
reserved3: 0x0
|
|
content: 010000001C000000000000001C000000000000001C00000002000000AD4F00003400000034000000B94F00000000000034000000030000000C000100100001000000000000000001
|
|
- cmd: LC_SEGMENT_64
|
|
cmdsize: 152
|
|
segname: __DATA
|
|
vmaddr: 32768
|
|
vmsize: 16384
|
|
fileoff: 32768
|
|
filesize: 16384
|
|
maxprot: 3
|
|
initprot: 3
|
|
nsects: 1
|
|
flags: 0
|
|
Sections:
|
|
- sectname: __objc_imageinfo
|
|
segname: __DATA
|
|
addr: 0x8000
|
|
size: 8
|
|
offset: 0x8000
|
|
align: 2
|
|
reloff: 0x0
|
|
nreloc: 0
|
|
flags: 0x0
|
|
reserved1: 0x0
|
|
reserved2: 0x0
|
|
reserved3: 0x0
|
|
content: '0000000040000000'
|
|
- cmd: LC_SEGMENT_64
|
|
cmdsize: 72
|
|
segname: __LINKEDIT
|
|
vmaddr: 49152
|
|
vmsize: 16384
|
|
fileoff: 49152
|
|
filesize: 88
|
|
maxprot: 1
|
|
initprot: 1
|
|
nsects: 0
|
|
flags: 0
|
|
- cmd: LC_ID_DYLIB
|
|
cmdsize: 96
|
|
dylib:
|
|
name: 24
|
|
timestamp: 1
|
|
current_version: 65536
|
|
compatibility_version: 65536
|
|
Content: '/System/Library/Frameworks/Xplatform.framework/Versions/A/Xplatform'
|
|
ZeroPadBytes: 5
|
|
- cmd: LC_DYLD_INFO_ONLY
|
|
cmdsize: 48
|
|
rebase_off: 0
|
|
rebase_size: 0
|
|
bind_off: 0
|
|
bind_size: 0
|
|
weak_bind_off: 0
|
|
weak_bind_size: 0
|
|
lazy_bind_off: 0
|
|
lazy_bind_size: 0
|
|
export_off: 49152
|
|
export_size: 16
|
|
- cmd: LC_SYMTAB
|
|
cmdsize: 24
|
|
symoff: 49184
|
|
nsyms: 2
|
|
stroff: 49216
|
|
strsize: 24
|
|
- cmd: LC_DYSYMTAB
|
|
cmdsize: 80
|
|
ilocalsym: 0
|
|
nlocalsym: 0
|
|
iextdefsym: 0
|
|
nextdefsym: 1
|
|
iundefsym: 1
|
|
nundefsym: 1
|
|
tocoff: 0
|
|
ntoc: 0
|
|
modtaboff: 0
|
|
nmodtab: 0
|
|
extrefsymoff: 0
|
|
nextrefsyms: 0
|
|
indirectsymoff: 0
|
|
nindirectsyms: 0
|
|
extreloff: 0
|
|
nextrel: 0
|
|
locreloff: 0
|
|
nlocrel: 0
|
|
- cmd: LC_UUID
|
|
cmdsize: 24
|
|
uuid: 4AA4F126-BD02-359C-B3EF-E53AD399B590
|
|
- cmd: LC_BUILD_VERSION
|
|
cmdsize: 32
|
|
platform: 1
|
|
minos: 659200
|
|
sdk: 721152
|
|
ntools: 1
|
|
Tools:
|
|
- tool: 3
|
|
version: 46008832
|
|
- cmd: LC_BUILD_VERSION
|
|
cmdsize: 32
|
|
platform: 6
|
|
minos: 0x00d0100
|
|
sdk: 851968
|
|
ntools: 1
|
|
Tools:
|
|
- tool: 3
|
|
version: 46008832
|
|
- cmd: LC_SOURCE_VERSION
|
|
cmdsize: 16
|
|
version: 0
|
|
- cmd: LC_SEGMENT_SPLIT_INFO
|
|
cmdsize: 16
|
|
dataoff: 49168
|
|
datasize: 8
|
|
- cmd: LC_LOAD_DYLIB
|
|
cmdsize: 56
|
|
dylib:
|
|
name: 24
|
|
timestamp: 2
|
|
current_version: 14942208
|
|
compatibility_version: 65536
|
|
Content: '/usr/lib/libobjc.A.dylib'
|
|
ZeroPadBytes: 8
|
|
- cmd: LC_LOAD_DYLIB
|
|
cmdsize: 56
|
|
dylib:
|
|
name: 24
|
|
timestamp: 2
|
|
current_version: 84687873
|
|
compatibility_version: 65536
|
|
Content: '/usr/lib/libSystem.B.dylib'
|
|
ZeroPadBytes: 6
|
|
- cmd: LC_FUNCTION_STARTS
|
|
cmdsize: 16
|
|
dataoff: 49176
|
|
datasize: 8
|
|
- cmd: LC_DATA_IN_CODE
|
|
cmdsize: 16
|
|
dataoff: 49184
|
|
datasize: 0
|
|
LinkEditData:
|
|
ExportTrie:
|
|
TerminalSize: 0
|
|
NodeOffset: 0
|
|
Name: ''
|
|
Flags: 0x0
|
|
Address: 0x0
|
|
Other: 0x0
|
|
ImportName: ''
|
|
Children:
|
|
- TerminalSize: 4
|
|
NodeOffset: 8
|
|
Name: _bar
|
|
Flags: 0x0
|
|
Address: 0x4FAD
|
|
Other: 0x0
|
|
ImportName: ''
|
|
NameList:
|
|
- n_strx: 2
|
|
n_type: 0xF
|
|
n_sect: 1
|
|
n_desc: 0
|
|
n_value: 20397
|
|
- n_strx: 7
|
|
n_type: 0x1
|
|
n_sect: 0
|
|
n_desc: 512
|
|
n_value: 0
|
|
StringTable:
|
|
- ' '
|
|
- _bar
|
|
- dyld_stub_binder
|
|
...
|
|
|
|
;--- inputs.json.in
|
|
{
|
|
"headers": [
|
|
{
|
|
"path" : "DSTROOT/Frameworks/Xplatform.framework/Headers/Xplatform.h",
|
|
"type" : "public"
|
|
}
|
|
],
|
|
"version": "3"
|
|
}
|