87 lines · plain
1; RUN: rm -rf %t2; RUN: split-file %s %t3 4// "Apple" label has split options between the optionlist & command line. 5; RUN: clang-installapi -target arm64-apple-macos12 \6; RUN: -install_name @rpath/libfoo.dylib -current_version 1 \7; RUN: -compatibility_version 1 \8; RUN: -extra-public-header %t/usr/include/opts.h \9; RUN: -optionlist %t/options.json -XApple -DCLI_OPT=1 \10; RUN: -I%S/Inputs/LibFoo/usr/include \11; RUN: -I%t/usr/include -dynamiclib -o %t/output.tbd 2>&1 | FileCheck %s -allow-empty 12; RUN: llvm-readtapi --compare %t/output.tbd %t/expected.tbd 2>&1 | FileCheck -allow-empty %s13 14// Validate duplicated options give same result.15; RUN: clang-installapi -target arm64-apple-macos12 \16; RUN: -install_name @rpath/libfoo.dylib -current_version 1 \17; RUN: -compatibility_version 1 \18; RUN: -extra-public-header %t/usr/include/opts.h \19; RUN: -optionlist %t/options.json -XApple -DCLI_OPT=1 \20; RUN: -I%S/Inputs/LibFoo/usr/include \21; RUN: -XApple -DDarwin -XElf -DNONDarwin \22; RUN: -I%t/usr/include -dynamiclib -o %t/output2.tbd 2>&1 | FileCheck %s -allow-empty 23; RUN: llvm-readtapi --compare %t/output2.tbd %t/expected.tbd 2>&1 | FileCheck -allow-empty %s24 25; CHECK-NOT: error26; CHECK-NOT: warning27 28;--- usr/include/opts.h29#ifndef OPTS_H30#define OPTS_H31#include <macro_defs.h>32 33#if defined(CLI_OPT) && CLI_OPT 34 #define SUFFIX "$final"35#else 36 #define SUFFIX 37#endif 38 39 40#define __STRING(x) #x41#define PLATFORM_ALIAS(sym) __asm("_" __STRING(sym) DARWIN LINUX SUFFIX)42extern int foo() PLATFORM_ALIAS(foo);43 44#endif 45 46;--- expected.tbd47{48 "main_library": {49 "exported_symbols": [50 {51 "text": {52 "global": [53 "_foo$darwin$final",54 "_foo$linux",55 "_foo"56 ]57 }58 }59 ],60 "flags": [61 {62 "attributes": [63 "not_app_extension_safe"64 ]65 }66 ],67 "install_names": [68 {69 "name": "@rpath/libfoo.dylib"70 }71 ],72 "target_info": [73 {74 "min_deployment": "12",75 "target": "arm64-macos"76 }77 ]78 },79 "tapi_tbd_version": 580}81 82//--- options.json83{84 "Apple" : ["-DDarwin=1"],85 "Elf" : ["-DNONDarwin=1"]86}87