]> git.saurik.com Git - apple/ld64.git/blame - src/Writers/ExecutableFileMachO-all.cpp
ld64-26.0.81.tar.gz
[apple/ld64.git] / src / Writers / ExecutableFileMachO-all.cpp
CommitLineData
c2646906
A
1/*
2 * Copyright (c) 2005 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#include <stdint.h>
25#include <stddef.h>
26#include <fcntl.h>
27#include <sys/time.h>
28#include <mach-o/loader.h>
29#include <mach-o/nlist.h>
30#include <mach-o/reloc.h>
31#include <mach-o/ppc/reloc.h>
32#include <mach-o/stab.h>
33
34#include <vector>
35#include <algorithm>
36#include <map>
37#include <set>
38
39#include "ObjectFile.h"
40#include "ExecutableFile.h"
41#include "Options.h"
42
43// buiild Writer for -arch ppc64
44#undef MACHO_32_SAME_ENDIAN
45#undef MACHO_32_OPPOSITE_ENDIAN
46#undef MACHO_64_SAME_ENDIAN
47#undef MACHO_64_OPPOSITE_ENDIAN
48#if __ppc__ || __ppc64__
49 #define MACHO_64_SAME_ENDIAN
50#elif __i386__
51 #define MACHO_64_OPPOSITE_ENDIAN
52#else
53 #error unknown architecture
54#endif
55namespace ppc64 {
56 #undef ARCH_PPC
57 #define ARCH_PPC64
58 #undef ARCH_I386
59 #include "MachOAbstraction.h"
60 #include "ExecutableFileMachO.cpp"
61};
62
63// buiild Writer for -arch ppc
64#undef MACHO_32_SAME_ENDIAN
65#undef MACHO_32_OPPOSITE_ENDIAN
66#undef MACHO_64_SAME_ENDIAN
67#undef MACHO_64_OPPOSITE_ENDIAN
68#if __ppc__ || __ppc64__
69 #define MACHO_32_SAME_ENDIAN
70#elif __i386__
71 #define MACHO_32_OPPOSITE_ENDIAN
72#else
73 #error unknown architecture
74#endif
75namespace ppc {
76 #define ARCH_PPC
77 #undef ARCH_PPC64
78 #undef ARCH_I386
79 #include "MachOAbstraction.h"
80 #include "ExecutableFileMachO.cpp"
81};
82
83// buiild Writer for -arch i386
84#undef MACHO_32_SAME_ENDIAN
85#undef MACHO_32_OPPOSITE_ENDIAN
86#undef MACHO_64_SAME_ENDIAN
87#undef MACHO_64_OPPOSITE_ENDIAN
88#if __ppc__ || __ppc64__
89 #define MACHO_32_OPPOSITE_ENDIAN
90#elif __i386__
91 #define MACHO_32_SAME_ENDIAN
92#else
93 #error unknown architecture
94#endif
95#undef i386 // compiler sometimes #defines this
96namespace i386 {
97 #undef ARCH_PPC
98 #undef ARCH_PPC64
99 #define ARCH_I386
100 #include "MachOAbstraction.h"
101 #include "ExecutableFileMachO.cpp"
102};
103
104