blob: 4cda37f9b2e3e0050761f6d7dd14c8e7a551bf44 [file] [log] [blame]
Daniel Dunbarce341cb2009-03-26 16:29:05 +00001// Check that ld gets arch_multiple.
2
Sebastian Pop9ec60df2012-01-20 22:01:23 +00003// RUN: %clang -target i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o foo 2> %t.log
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00004// RUN: grep '".*ld.*" .*"-arch_multiple" "-final_output" "foo"' %t.log
Daniel Dunbarce341cb2009-03-26 16:29:05 +00005
Daniel Dunbar0b46e1b2009-04-04 00:55:30 +00006// Make sure we run dsymutil on source input files.
Sebastian Pop9ec60df2012-01-20 22:01:23 +00007// RUN: %clang -target i386-apple-darwin9 -### -g %s -o BAR 2> %t.log
Daniel Dunbar03e92302011-05-09 17:23:16 +00008// RUN: grep '".*dsymutil" "-o" "BAR.dSYM" "BAR"' %t.log
Sebastian Pop9ec60df2012-01-20 22:01:23 +00009// RUN: %clang -target i386-apple-darwin9 -### -g -filelist FOO %s -o BAR 2> %t.log
Daniel Dunbar03e92302011-05-09 17:23:16 +000010// RUN: grep '".*dsymutil" "-o" "BAR.dSYM" "BAR"' %t.log
Daniel Dunbar0b46e1b2009-04-04 00:55:30 +000011
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000012// Check linker changes that came with new linkedit format.
13// RUN: touch %t.o
Sebastian Pop9ec60df2012-01-20 22:01:23 +000014// RUN: %clang -target i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 %t.o 2> %t.log
15// RUN: %clang -target i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -dynamiclib %t.o 2>> %t.log
16// RUN: %clang -target i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -bundle %t.o 2>> %t.log
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000017// RUN: FileCheck -check-prefix=LINK_IPHONE_3_0 %s < %t.log
Daniel Dunbarce341cb2009-03-26 16:29:05 +000018
Francois Pichet880cf252010-09-11 20:43:12 +000019// LINK_IPHONE_3_0: {{ld(.exe)?"}}
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000020// LINK_IPHONE_3_0-NOT: -lcrt1.3.1.o
21// LINK_IPHONE_3_0: -lcrt1.o
22// LINK_IPHONE_3_0: -lSystem
Francois Pichet880cf252010-09-11 20:43:12 +000023// LINK_IPHONE_3_0: {{ld(.exe)?"}}
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000024// LINK_IPHONE_3_0: -dylib
25// LINK_IPHONE_3_0: -ldylib1.o
26// LINK_IPHONE_3_0: -lSystem
Francois Pichet880cf252010-09-11 20:43:12 +000027// LINK_IPHONE_3_0: {{ld(.exe)?"}}
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000028// LINK_IPHONE_3_0: -lbundle1.o
29// LINK_IPHONE_3_0: -lSystem
Daniel Dunbarce341cb2009-03-26 16:29:05 +000030
Sebastian Pop9ec60df2012-01-20 22:01:23 +000031// RUN: %clang -target i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 %t.o 2> %t.log
32// RUN: %clang -target i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -dynamiclib %t.o 2>> %t.log
33// RUN: %clang -target i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -bundle %t.o 2>> %t.log
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000034// RUN: FileCheck -check-prefix=LINK_IPHONE_3_1 %s < %t.log
35
Francois Pichet880cf252010-09-11 20:43:12 +000036// LINK_IPHONE_3_1: {{ld(.exe)?"}}
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000037// LINK_IPHONE_3_1-NOT: -lcrt1.o
38// LINK_IPHONE_3_1: -lcrt1.3.1.o
39// LINK_IPHONE_3_1: -lSystem
Francois Pichet880cf252010-09-11 20:43:12 +000040// LINK_IPHONE_3_1: {{ld(.exe)?"}}
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000041// LINK_IPHONE_3_1: -dylib
42// LINK_IPHONE_3_1-NOT: -ldylib1.o
43// LINK_IPHONE_3_1: -lSystem
Francois Pichet880cf252010-09-11 20:43:12 +000044// LINK_IPHONE_3_1: {{ld(.exe)?"}}
Daniel Dunbarcacb0f02010-01-27 00:56:56 +000045// LINK_IPHONE_3_1-NOT: -lbundle1.o
46// LINK_IPHONE_3_1: -lSystem
Daniel Dunbar47e879d2010-07-13 23:31:40 +000047
Sebastian Pop9ec60df2012-01-20 22:01:23 +000048// RUN: %clang -target i386-apple-darwin9 -### -fpie %t.o 2> %t.log
Daniel Dunbar47e879d2010-07-13 23:31:40 +000049// RUN: FileCheck -check-prefix=LINK_EXPLICIT_PIE %s < %t.log
50//
Francois Pichet880cf252010-09-11 20:43:12 +000051// LINK_EXPLICIT_PIE: {{ld(.exe)?"}}
Daniel Dunbar47e879d2010-07-13 23:31:40 +000052// LINK_EXPLICIT_PIE: "-pie"
53
Sebastian Pop9ec60df2012-01-20 22:01:23 +000054// RUN: %clang -target i386-apple-darwin9 -### -fno-pie %t.o 2> %t.log
Daniel Dunbar47e879d2010-07-13 23:31:40 +000055// RUN: FileCheck -check-prefix=LINK_EXPLICIT_NO_PIE %s < %t.log
56//
Francois Pichet880cf252010-09-11 20:43:12 +000057// LINK_EXPLICIT_NO_PIE: {{ld(.exe)?"}}
Daniel Dunbar47e879d2010-07-13 23:31:40 +000058// LINK_EXPLICIT_NO_PIE: "-no_pie"
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000059
Sebastian Pop9ec60df2012-01-20 22:01:23 +000060// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000061// RUN: -mlinker-version=100 2> %t.log
62// RUN: FileCheck -check-prefix=LINK_NEWER_DEMANGLE %s < %t.log
63//
Francois Pichet880cf252010-09-11 20:43:12 +000064// LINK_NEWER_DEMANGLE: {{ld(.exe)?"}}
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000065// LINK_NEWER_DEMANGLE: "-demangle"
66
Sebastian Pop9ec60df2012-01-20 22:01:23 +000067// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000068// RUN: -mlinker-version=100 -Wl,--no-demangle 2> %t.log
69// RUN: FileCheck -check-prefix=LINK_NEWER_NODEMANGLE %s < %t.log
70//
Francois Pichet880cf252010-09-11 20:43:12 +000071// LINK_NEWER_NODEMANGLE: {{ld(.exe)?"}}
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000072// LINK_NEWER_NODEMANGLE-NOT: "-demangle"
Daniel Dunbar673745f2010-08-23 20:58:55 +000073// LINK_NEWER_NODEMANGLE: "-lSystem"
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000074
Sebastian Pop9ec60df2012-01-20 22:01:23 +000075// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000076// RUN: -mlinker-version=95 2> %t.log
77// RUN: FileCheck -check-prefix=LINK_OLDER_NODEMANGLE %s < %t.log
78//
Francois Pichet880cf252010-09-11 20:43:12 +000079// LINK_OLDER_NODEMANGLE: {{ld(.exe)?"}}
Daniel Dunbarb18dc5b2010-08-11 23:07:50 +000080// LINK_OLDER_NODEMANGLE-NOT: "-demangle"
Daniel Dunbar673745f2010-08-23 20:58:55 +000081// LINK_OLDER_NODEMANGLE: "-lSystem"
Daniel Dunbar5bfa6562011-06-21 20:55:11 +000082
Sebastian Pop9ec60df2012-01-20 22:01:23 +000083// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Daniel Dunbara68e1c32011-06-21 21:18:32 +000084// RUN: -mlinker-version=117 -flto 2> %t.log
Daniel Dunbar5bfa6562011-06-21 20:55:11 +000085// RUN: cat %t.log
86// RUN: FileCheck -check-prefix=LINK_OBJECT_LTO_PATH %s < %t.log
87//
88// LINK_OBJECT_LTO_PATH: {{ld(.exe)?"}}
89// LINK_OBJECT_LTO_PATH: "-object_path_lto"
Daniel Dunbar99ca47b2011-06-28 20:16:02 +000090
Sebastian Pop9ec60df2012-01-20 22:01:23 +000091// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Daniel Dunbar99ca47b2011-06-28 20:16:02 +000092// RUN: -force_load a -force_load b 2> %t.log
93// RUN: cat %t.log
94// RUN: FileCheck -check-prefix=FORCE_LOAD %s < %t.log
95//
96// FORCE_LOAD: {{ld(.exe)?"}}
97// FORCE_LOAD: "-force_load" "a" "-force_load" "b"
Chad Rosieredb94592012-01-05 01:56:11 +000098
Sebastian Pop9ec60df2012-01-20 22:01:23 +000099// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Chad Rosieredb94592012-01-05 01:56:11 +0000100// RUN: -lazy_framework Framework 2> %t.log
101//
102// RUN: FileCheck -check-prefix=LINK_LAZY_FRAMEWORK %s < %t.log
103// LINK_LAZY_FRAMEWORK: {{ld(.exe)?"}}
104// LINK_LAZY_FRAMEWORK: "-lazy_framework" "Framework"
105
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000106// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
Chad Rosieredb94592012-01-05 01:56:11 +0000107// RUN: -lazy_library Library 2> %t.log
108//
109// RUN: FileCheck -check-prefix=LINK_LAZY_LIBRARY %s < %t.log
110// LINK_LAZY_LIBRARY: {{ld(.exe)?"}}
111// LINK_LAZY_LIBRARY: "-lazy_library" "Library"
Bob Wilson10853772012-01-31 21:30:03 +0000112
113// RUN: %clang -target x86_64-apple-darwin10 -### %t.o 2> %t.log
114// RUN: %clang -target x86_64-apple-macosx10.7 -### %t.o 2>> %t.log
115// RUN: FileCheck -check-prefix=LINK_VERSION_MIN %s < %t.log
116// LINK_VERSION_MIN: {{ld(.exe)?"}}
117// LINK_VERSION_MIN: "-macosx_version_min" "10.6.0"
118// LINK_VERSION_MIN: {{ld(.exe)?"}}
119// LINK_VERSION_MIN: "-macosx_version_min" "10.7.0"
Ted Kremenekebcb57a2012-03-06 20:05:56 +0000120
121// RUN: %clang -target x86_64-apple-darwin12 -### %t.o 2> %t.log
122// RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log
123// LINK_NO_CRT1-NOT: crt
Bob Wilson1fc6e4f2012-07-03 20:42:10 +0000124
125// RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log
126// RUN: FileCheck -check-prefix=LINK_PG %s < %t.log
127// LINK_PG: -lgcrt1.o
128// LINK_PG: -no_new_main