Daniel Dunbar | ce341cb | 2009-03-26 16:29:05 +0000 | [diff] [blame] | 1 | // Check that ld gets arch_multiple. |
| 2 | |
Daniel Dunbar | 80737ad | 2009-12-15 22:01:24 +0000 | [diff] [blame] | 3 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o foo 2> %t.log |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 4 | // RUN: grep '".*ld.*" .*"-arch_multiple" "-final_output" "foo"' %t.log |
Daniel Dunbar | ce341cb | 2009-03-26 16:29:05 +0000 | [diff] [blame] | 5 | |
Daniel Dunbar | 0b46e1b | 2009-04-04 00:55:30 +0000 | [diff] [blame] | 6 | // Make sure we run dsymutil on source input files. |
Daniel Dunbar | 80737ad | 2009-12-15 22:01:24 +0000 | [diff] [blame] | 7 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -g %s -o BAR 2> %t.log |
Daniel Dunbar | 03e9230 | 2011-05-09 17:23:16 +0000 | [diff] [blame^] | 8 | // RUN: grep '".*dsymutil" "-o" "BAR.dSYM" "BAR"' %t.log |
Daniel Dunbar | 80737ad | 2009-12-15 22:01:24 +0000 | [diff] [blame] | 9 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -g -filelist FOO %s -o BAR 2> %t.log |
Daniel Dunbar | 03e9230 | 2011-05-09 17:23:16 +0000 | [diff] [blame^] | 10 | // RUN: grep '".*dsymutil" "-o" "BAR.dSYM" "BAR"' %t.log |
Daniel Dunbar | 0b46e1b | 2009-04-04 00:55:30 +0000 | [diff] [blame] | 11 | |
Daniel Dunbar | ce341cb | 2009-03-26 16:29:05 +0000 | [diff] [blame] | 12 | // Splatter test case. This is gross, but it works for now. For the |
| 13 | // driver, just getting coverage of the tool code and checking the |
| 14 | // output options is nearly good enough. The main thing we are |
| 15 | // protecting against here is unintended changes in the driver |
| 16 | // output. Intended changes should add more reasonable test cases, and |
| 17 | // just update this test to match the expected behavior. |
| 18 | // |
| 19 | // Note that at conception, this exactly matches gcc. |
| 20 | |
Daniel Dunbar | ce911f5 | 2011-04-28 21:23:41 +0000 | [diff] [blame] | 21 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -A ARG0 -F ARG1 -L ARG2 -Mach -T ARG4 -X -Z -all_load -allowable_client ARG8 -bind_at_load -compatibility_version ARG11 -current_version ARG12 -d -dead_strip -dylib_file ARG14 -dylinker -dylinker_install_name ARG16 -dynamic -dynamiclib -e ARG19 -exported_symbols_list ARG20 -fexceptions -flat_namespace -fnested-functions -fopenmp -force_cpusubtype_ALL -fpie -fprofile-arcs -headerpad_max_install_names -image_base ARG29 -init ARG30 -install_name ARG31 -m ARG33 -mmacosx-version-min=10.3.2 -multi_module -multiply_defined ARG37 -multiply_defined_unused ARG38 -no_dead_strip_inits_and_terms -nodefaultlibs -nofixprebinding -nomultidefs -noprebind -noseglinkedit -nostartfiles -nostdlib -pagezero_size ARG54 -pg -prebind -prebind_all_twolevel_modules -preload -r -read_only_relocs ARG55 -s -sectalign ARG57_0 ARG57_1 ARG57_2 -sectcreate ARG58_0 ARG58_1 ARG58_2 -sectobjectsymbols ARG59_0 ARG59_1 -sectorder ARG60_0 ARG60_1 ARG60_2 -seg1addr ARG61 -seg_addr_table ARG62 -seg_addr_table_filename ARG63 -segaddr ARG64_0 ARG64_1 -segcreate ARG65_0 ARG65_1 ARG65_2 -seglinkedit -segprot ARG67_0 ARG67_1 ARG67_2 -segs_read_FOO -segs_read_only_addr ARG69 -segs_read_write_addr ARG70 -shared-libgcc -single_module -static -static-libgcc -sub_library ARG77 -sub_umbrella ARG78 -t -twolevel_namespace -twolevel_namespace_hints -u ARG82 -umbrella ARG83 -undefined ARG84 -unexported_symbols_list ARG85 -w -weak_reference_mismatches ARG87 -whatsloaded -whyload -y -filelist FOO -l FOO 2> %t.log |
| 22 | // RUN: grep '".*ld.*" "-static" "-dylib" "-dylib_compatibility_version" "ARG11" "-dylib_current_version" "ARG12" "-arch" "i386" "-dylib_install_name" "ARG31" "-all_load" "-allowable_client" "ARG8" "-bind_at_load" "-dead_strip" "-no_dead_strip_inits_and_terms" "-dylib_file" "ARG14" "-dynamic" "-exported_symbols_list" "ARG20" "-flat_namespace" "-headerpad_max_install_names" "-image_base" "ARG29" "-init" "ARG30" "-macosx_version_min" "10.3.2" "-nomultidefs" "-multi_module" "-single_module" "-multiply_defined" "ARG37" "-multiply_defined_unused" "ARG38" "-pie" "-prebind" "-noprebind" "-nofixprebinding" "-prebind_all_twolevel_modules" "-read_only_relocs" "ARG55" "-sectcreate" "ARG58_0" "ARG58_1" "ARG58_2" "-sectorder" "ARG60_0" "ARG60_1" "ARG60_2" "-seg1addr" "ARG61" "-segprot" "ARG67_0" "ARG67_1" "ARG67_2" "-segaddr" "ARG64_0" "ARG64_1" "-segs_read_only_addr" "ARG69" "-segs_read_write_addr" "ARG70" "-seg_addr_table" "ARG62" "-seg_addr_table_filename" "ARG63" "-sub_library" "ARG77" "-sub_umbrella" "ARG78" "-twolevel_namespace" "-twolevel_namespace_hints" "-umbrella" "ARG83" "-undefined" "ARG84" "-unexported_symbols_list" "ARG85" "-weak_reference_mismatches" "ARG87" "-X" "-y" "-w" "-pagezero_size" "ARG54" "-segs_read_FOO" "-seglinkedit" "-noseglinkedit" "-sectalign" "ARG57_0" "ARG57_1" "ARG57_2" "-sectobjectsymbols" "ARG59_0" "ARG59_1" "-segcreate" "ARG65_0" "ARG65_1" "ARG65_2" "-whyload" "-whatsloaded" "-dylinker_install_name" "ARG16" "-dylinker" "-Mach" "-d" "-s" "-t" "-Z" "-u" "ARG82" "-undefined" "ARG84" "-A" "ARG0" "-e" "ARG19" "-m" "ARG33" "-r" "-o" "a.out" "-LARG2" "-lgomp".* "-filelist" "FOO" "-lFOO" "-lgcov" "-allow_stack_execute" "-T" "ARG4" "-FARG1"' %t.log |
Daniel Dunbar | ce341cb | 2009-03-26 16:29:05 +0000 | [diff] [blame] | 23 | |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 24 | // Check linker changes that came with new linkedit format. |
| 25 | // RUN: touch %t.o |
Daniel Dunbar | f2dd48c | 2010-01-27 04:03:51 +0000 | [diff] [blame] | 26 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 %t.o 2> %t.log |
| 27 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -dynamiclib %t.o 2>> %t.log |
| 28 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -bundle %t.o 2>> %t.log |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 29 | // RUN: FileCheck -check-prefix=LINK_IPHONE_3_0 %s < %t.log |
Daniel Dunbar | ce341cb | 2009-03-26 16:29:05 +0000 | [diff] [blame] | 30 | |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 31 | // LINK_IPHONE_3_0: {{ld(.exe)?"}} |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 32 | // LINK_IPHONE_3_0-NOT: -lcrt1.3.1.o |
| 33 | // LINK_IPHONE_3_0: -lcrt1.o |
| 34 | // LINK_IPHONE_3_0: -lSystem |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 35 | // LINK_IPHONE_3_0: {{ld(.exe)?"}} |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 36 | // LINK_IPHONE_3_0: -dylib |
| 37 | // LINK_IPHONE_3_0: -ldylib1.o |
| 38 | // LINK_IPHONE_3_0: -lSystem |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 39 | // LINK_IPHONE_3_0: {{ld(.exe)?"}} |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 40 | // LINK_IPHONE_3_0: -lbundle1.o |
| 41 | // LINK_IPHONE_3_0: -lSystem |
Daniel Dunbar | ce341cb | 2009-03-26 16:29:05 +0000 | [diff] [blame] | 42 | |
Daniel Dunbar | f2dd48c | 2010-01-27 04:03:51 +0000 | [diff] [blame] | 43 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 %t.o 2> %t.log |
| 44 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -dynamiclib %t.o 2>> %t.log |
| 45 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -bundle %t.o 2>> %t.log |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 46 | // RUN: FileCheck -check-prefix=LINK_IPHONE_3_1 %s < %t.log |
| 47 | |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 48 | // LINK_IPHONE_3_1: {{ld(.exe)?"}} |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 49 | // LINK_IPHONE_3_1-NOT: -lcrt1.o |
| 50 | // LINK_IPHONE_3_1: -lcrt1.3.1.o |
| 51 | // LINK_IPHONE_3_1: -lSystem |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 52 | // LINK_IPHONE_3_1: {{ld(.exe)?"}} |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 53 | // LINK_IPHONE_3_1: -dylib |
| 54 | // LINK_IPHONE_3_1-NOT: -ldylib1.o |
| 55 | // LINK_IPHONE_3_1: -lSystem |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 56 | // LINK_IPHONE_3_1: {{ld(.exe)?"}} |
Daniel Dunbar | cacb0f0 | 2010-01-27 00:56:56 +0000 | [diff] [blame] | 57 | // LINK_IPHONE_3_1-NOT: -lbundle1.o |
| 58 | // LINK_IPHONE_3_1: -lSystem |
Daniel Dunbar | 47e879d | 2010-07-13 23:31:40 +0000 | [diff] [blame] | 59 | |
| 60 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -fpie %t.o 2> %t.log |
| 61 | // RUN: FileCheck -check-prefix=LINK_EXPLICIT_PIE %s < %t.log |
| 62 | // |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 63 | // LINK_EXPLICIT_PIE: {{ld(.exe)?"}} |
Daniel Dunbar | 47e879d | 2010-07-13 23:31:40 +0000 | [diff] [blame] | 64 | // LINK_EXPLICIT_PIE: "-pie" |
| 65 | |
| 66 | // RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -fno-pie %t.o 2> %t.log |
| 67 | // RUN: FileCheck -check-prefix=LINK_EXPLICIT_NO_PIE %s < %t.log |
| 68 | // |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 69 | // LINK_EXPLICIT_NO_PIE: {{ld(.exe)?"}} |
Daniel Dunbar | 47e879d | 2010-07-13 23:31:40 +0000 | [diff] [blame] | 70 | // LINK_EXPLICIT_NO_PIE: "-no_pie" |
Daniel Dunbar | b18dc5b | 2010-08-11 23:07:50 +0000 | [diff] [blame] | 71 | |
| 72 | // RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \ |
| 73 | // RUN: -mlinker-version=100 2> %t.log |
| 74 | // RUN: FileCheck -check-prefix=LINK_NEWER_DEMANGLE %s < %t.log |
| 75 | // |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 76 | // LINK_NEWER_DEMANGLE: {{ld(.exe)?"}} |
Daniel Dunbar | b18dc5b | 2010-08-11 23:07:50 +0000 | [diff] [blame] | 77 | // LINK_NEWER_DEMANGLE: "-demangle" |
| 78 | |
| 79 | // RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \ |
| 80 | // RUN: -mlinker-version=100 -Wl,--no-demangle 2> %t.log |
| 81 | // RUN: FileCheck -check-prefix=LINK_NEWER_NODEMANGLE %s < %t.log |
| 82 | // |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 83 | // LINK_NEWER_NODEMANGLE: {{ld(.exe)?"}} |
Daniel Dunbar | b18dc5b | 2010-08-11 23:07:50 +0000 | [diff] [blame] | 84 | // LINK_NEWER_NODEMANGLE-NOT: "-demangle" |
Daniel Dunbar | 673745f | 2010-08-23 20:58:55 +0000 | [diff] [blame] | 85 | // LINK_NEWER_NODEMANGLE: "-lSystem" |
Daniel Dunbar | b18dc5b | 2010-08-11 23:07:50 +0000 | [diff] [blame] | 86 | |
| 87 | // RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \ |
| 88 | // RUN: -mlinker-version=95 2> %t.log |
| 89 | // RUN: FileCheck -check-prefix=LINK_OLDER_NODEMANGLE %s < %t.log |
| 90 | // |
Francois Pichet | 880cf25 | 2010-09-11 20:43:12 +0000 | [diff] [blame] | 91 | // LINK_OLDER_NODEMANGLE: {{ld(.exe)?"}} |
Daniel Dunbar | b18dc5b | 2010-08-11 23:07:50 +0000 | [diff] [blame] | 92 | // LINK_OLDER_NODEMANGLE-NOT: "-demangle" |
Daniel Dunbar | 673745f | 2010-08-23 20:58:55 +0000 | [diff] [blame] | 93 | // LINK_OLDER_NODEMANGLE: "-lSystem" |