]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/efi-basic/Makefile
ld64-351.8.tar.gz
[apple/ld64.git] / unit-tests / test-cases / efi-basic / Makefile
1 ##
2 # Copyright (c) 2005-2010 Apple Computer, 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
24 #
25 # This test verifies ld -preload support required for mtoc
26 # to create a PE/COFF image that will work with EFI.
27 # The mach-o file and pecoff files are parsed with the
28 # test.py script to make sure the images look OK.
29 #
30 # Note: We should fail with an error condition if any of the all:
31 # commands fail.
32 # Note: Currently does not support ARM due to no ARM support in
33 # /usr/local/efi/bin/objdump
34 #
35 TESTROOT = ../..
36 include ${TESTROOT}/include/common.makefile
37
38 LOCAL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces
39
40 #ARCH=x86_64
41 #ARCH=i386
42
43
44 ifeq (${ARCH},x86_64)
45 OBJ_DUMP_ARCH=efi-app-x86-64
46 LD_ARG=
47 else
48 OBJ_DUMP_ARCH=efi-app-ia32
49 LD_ARG=-read_only_relocs suppress
50 endif
51
52
53 #
54 # Compile the file
55 #
56
57 all:
58 ${CC} -arch $(ARCH) -o LibTest1.obj $(LOCAL_CC_FLAGS) -c LibTest.c
59 libtool -static -o LibTest1.lib LibTest1.obj
60 ${CC} -arch $(ARCH) -o MtocTest1.obj $(LOCAL_CC_FLAGS) -c MtocTest.c
61 libtool -static -o MtocTest1.lib MtocTest1.obj
62 ${LD} -arch $(ARCH) -o MtocTest1.macho -u __ModuleEntryPoint -e __ModuleEntryPoint $(LD_ARG) -preload -segalign 0x20 -pie -seg1addr 0x240 -map MtocTest1.map LibTest1.lib MtocTest1.lib
63 /usr/local/efi/bin/mtoc -subsystem application -align 0x20 -d MtocTest1.macho MtocTest1.macho MtocTest1.pecoff
64 otool -rR MtocTest1.macho > otool-reloc.log
65 otool -l MtocTest1.macho > otool-load.log
66 /usr/local/efi/bin/objdump -b $(OBJ_DUMP_ARCH) -x MtocTest1.pecoff > objdump-raw.log
67 ${PASS_IFF_SUCCESS} ./mtoctest.py --arch $(ARCH)
68
69
70 clean:
71 rm -rf *.pecoff *.macho *.obj *.log *.lib *.map
72
73