]> git.saurik.com Git - apple/ld64.git/blame - unit-tests/test-cases/tentative-and-archive-code/Makefile
ld64-133.3.tar.gz
[apple/ld64.git] / unit-tests / test-cases / tentative-and-archive-code / Makefile
CommitLineData
afe874b1
A
1##
2# Copyright (c) 2011 Apple Inc. All rights reserved.
3#
4# @APPLE_LICENSE_HEADER_START@
5#
6# This file contains Original Code and/or Modifications of Original Code
7# as defined in and that are subject to the Apple Public Source License
8# Version 2.0 (the 'License'). You may not use this file except in
9# compliance with the License. Please obtain a copy of the License at
10# http://www.opensource.apple.com/apsl/ and read it before using this
11# file.
12#
13# The Original Code and all software distributed under the License are
14# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18# Please see the License for the specific language governing rights and
19# limitations under the License.
20#
21# @APPLE_LICENSE_HEADER_END@
22##
23TESTROOT = ../..
24include ${TESTROOT}/include/common.makefile
25
26SHELL = bash # use bash shell so we can redirect just stderr
27
28
29#
30# Test how tentative definitions interact with archives
31# main.c has a tenative definition for _foo which
32# should cause libfoo_data.a to be loaded, but not libfoo_tent.a
33# nor libfoo_code.a.
34#
35# <rdar://problem/7890410> Snow Leopard linker bug with common symbols
36#
37
38run: all
39
40all:
41 ${CC} ${CCFLAGS} junk.c -c -o junk.o
42 # verify data symbol does get pulled in
43 ${CC} ${CCFLAGS} foo_data.c -c -o foo_data.o
44 libtool -static junk.o foo_data.o -o libfoo_data.a
45 ${CC} ${CCFLAGS} main.c libfoo_data.a -o main_data
46 nm -m main_data | grep _foo | grep __TEXT | ${FAIL_IF_STDIN}
47 # verify tentative does not
48 ${CC} ${CCFLAGS} foo_tent.c -c -o foo_tent.o
49 libtool -static junk.o foo_tent.o -o libfoo_tent.a
50 ${CC} ${CCFLAGS} main.c libfoo_tent.a -o main_tent
51 nm -m main_tent | grep _foo | grep __TEXT | ${FAIL_IF_STDIN}
52 # verify code does not
53 ${CC} ${CCFLAGS} foo_code.c -c -o foo_code.o
54 libtool -static junk.o foo_code.o -o libfoo_code.a
55 ${CC} ${CCFLAGS} main.c libfoo_code.a -o main_code
56 nm -m main_code | grep _foo | grep __TEXT | ${FAIL_IF_STDIN}
57 # verify warning when code force to override tent
ebf6f434
A
58 #${CC} ${CCFLAGS} main.c -Wl,-force_load,libfoo_code.a -o main_code_force 2>main_code_force_warnings.txt
59 #grep warning main_code_force_warnings.txt | ${FAIL_IF_EMPTY}
afe874b1
A
60 ${PASS_IFF_GOOD_MACHO} main_code
61
62clean:
63 rm -rf junk.o foo_data.o libfoo_data.a main_data foo_tent.o libfoo_tent.a main_tent foo_code.o libfoo_code.a main_code main_code_force main_code_force_warnings.txt
64