]> git.saurik.com Git - apple/ld64.git/blame - src/Readers/ObjectFileMachO-all.cpp
ld64-26.0.81.tar.gz
[apple/ld64.git] / src / Readers / ObjectFileMachO-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
25#include <sys/types.h>
26#include <sys/stat.h>
27#include <sys/mman.h>
28#include <unistd.h>
29#include <fcntl.h>
30#include <string.h>
31#include <math.h>
32#include <ar.h>
33
34#include <algorithm>
35#include <vector>
36#include <set>
37
38#include <mach-o/loader.h>
39#include <mach-o/nlist.h>
40#include <mach-o/reloc.h>
41#include <mach-o/ppc/reloc.h>
42#include <mach-o/ranlib.h>
43#include <mach-o/stab.h>
44
45#include "ObjectFile.h"
46#include "Options.h"
47
48
49
50
51// buiild Writer for -arch ppc64
52#undef MACHO_32_SAME_ENDIAN
53#undef MACHO_32_OPPOSITE_ENDIAN
54#undef MACHO_64_SAME_ENDIAN
55#undef MACHO_64_OPPOSITE_ENDIAN
56#if __ppc__ || __ppc64__
57 #define MACHO_64_SAME_ENDIAN
58#elif __i386__
59 #define MACHO_64_OPPOSITE_ENDIAN
60#else
61 #error unknown architecture
62#endif
63namespace ppc64 {
64 #undef ARCH_PPC
65 #define ARCH_PPC64
66 #undef ARCH_I386
67 #include "MachOAbstraction.h"
68 #include "ObjectFileMachO.cpp"
69 #include "ObjectFileDylibMachO.cpp"
70 #include "ObjectFileArchiveMachO.cpp"
71};
72
73// buiild Writer for -arch ppc
74#undef MACHO_32_SAME_ENDIAN
75#undef MACHO_32_OPPOSITE_ENDIAN
76#undef MACHO_64_SAME_ENDIAN
77#undef MACHO_64_OPPOSITE_ENDIAN
78#if __ppc__ || __ppc64__
79 #define MACHO_32_SAME_ENDIAN
80#elif __i386__
81 #define MACHO_32_OPPOSITE_ENDIAN
82#else
83 #error unknown architecture
84#endif
85namespace ppc {
86 #define ARCH_PPC
87 #undef ARCH_PPC64
88 #undef ARCH_I386
89 #include "MachOAbstraction.h"
90 #include "ObjectFileMachO.cpp"
91 #include "ObjectFileDylibMachO.cpp"
92 #include "ObjectFileArchiveMachO.cpp"
93};
94
95
96// buiild Writer for -arch i386
97#undef MACHO_32_SAME_ENDIAN
98#undef MACHO_32_OPPOSITE_ENDIAN
99#undef MACHO_64_SAME_ENDIAN
100#undef MACHO_64_OPPOSITE_ENDIAN
101#if __ppc__ || __ppc64__
102 #define MACHO_32_OPPOSITE_ENDIAN
103#elif __i386__
104 #define MACHO_32_SAME_ENDIAN
105#else
106 #error unknown architecture
107#endif
108#undef i386 // compiler sometimes #defines this
109namespace i386 {
110 #undef ARCH_PPC
111 #undef ARCH_PPC64
112 #define ARCH_I386
113 #include "MachOAbstraction.h"
114 #include "ObjectFileMachO.cpp"
115 #include "ObjectFileDylibMachO.cpp"
116 #include "ObjectFileArchiveMachO.cpp"
117};
118
119