]>
Commit | Line | Data |
---|---|---|
b1f7435d A |
1 | ## |
2 | # Copyright (c) 2012 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 | ## | |
23 | TESTROOT = ../.. | |
24 | include ${TESTROOT}/include/common.makefile | |
25 | ||
26 | # | |
27 | # Validate these pipelined linking cases: | |
28 | # - missing pipe | |
29 | # - bad file passed via pipe | |
30 | # - eof on pipe | |
31 | # - success case | |
32 | # - differing file orders produce same binary | |
33 | # | |
34 | # When testing the success case take care to verify that pipelined linking is actually | |
35 | # enabled (environment variable is set). Because there is no difference in the command | |
36 | # line the test will still succeed with pipelined linking turned off, without testing | |
37 | # pipelined linking. | |
38 | # | |
39 | ||
40 | all: | |
41 | # Make some object files | |
42 | ${CC} ${CCFLAGS} foo.c -c -o foo.o | |
43 | ${CC} ${CCFLAGS} bar.c -c -o bar.o | |
44 | ${CC} ${CCFLAGS} cat.c -c -o cat.o | |
45 | ls *.o > filelist | |
46 | ||
47 | # missing fifo | |
48 | (LD_PIPELINE_FIFO=bad_fifo ; export LD_PIPELINE_FIFO ; ${CC} ${CCFLAGS} -filelist filelist -o partial ; exit 0) 2>&1 | ${PASS_IFF_STDIN} | |
49 | ||
50 | # partial file list passed via pipe | |
51 | head -1 filelist > pipelineFile | |
52 | (LD_PIPELINE_FIFO=pipelineFile ; export LD_PIPELINE_FIFO ; ${CC} ${CCFLAGS} -filelist filelist -o partial ; exit 0) 2>&1 | ${PASS_IFF_STDIN} | |
53 | ${FAIL_IFF} ${MACHOCHECK} partial 2>&1 > /dev/null | |
54 | ||
55 | # bogus file passed via pipe | |
56 | echo "bogus_file.o" > pipelineFile | |
57 | (LD_PIPELINE_FIFO=pipelineFile ; export LD_PIPELINE_FIFO ; ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} -filelist filelist -o bogus ; exit 0) 2>&1 | ${PASS_IFF_STDIN} | |
58 | ${FAIL_IFF} ${MACHOCHECK} bogus 2>&1 > /dev/null | |
59 | ||
60 | # success cases - check different orderings of files | |
61 | sort < filelist > pipelineFile | |
62 | (LD_PIPELINE_FIFO=pipelineFile ; export LD_PIPELINE_FIFO ; ${CC} ${CCFLAGS} -filelist filelist -o normal) | |
63 | ${FAIL_IF_BAD_MACHO} normal | |
64 | sort -r < filelist > pipelineFile | |
65 | (LD_PIPELINE_FIFO=pipelineFile ; export LD_PIPELINE_FIFO ; ${CC} ${CCFLAGS} -filelist filelist -o reverse) | |
66 | ${FAIL_IF_BAD_MACHO} reverse | |
67 | ||
68 | # verify that the same binary was generated using both forward and reverse ordering | |
69 | ${PASS_IFF} cmp reverse normal | |
70 | ||
71 | ||
72 | clean: | |
73 | rm -f *.o filelist partial bogus reverse normal pipelineFile | |
74 |