Chameleon

Chameleon Commit Details

Date:2012-10-27 07:28:33 (7 years 5 months ago)
Author:Evan Lojewski
Commit:2090
Parents: 2089
Message:Enable clang compilation. Migrate to ld. Remove use gcc option. remove md. remove _nodep rules. Remove ld_classic.
Changes:
D/trunk/bin
D/trunk/i386/md
M/trunk/i386/Cconfig
M/trunk/i386/modules/Keylayout/layouts/Makefile
M/trunk/i386/modules/MakeInc.dir
M/trunk/Make.rules
M/trunk/i386/Makefile
M/trunk/i386/boot2/Makefile

File differences

trunk/i386/boot2/Makefile
2121
2222
2323
24
25
26
24
25
2726
2827
2928
......
6564
6665
6766
67
68
6869
6970
7071
......
7879
7980
8081
81
8282
83
84
8385
84
85
86
86
87
88
89
90
91
8792
93
94
95
96
97
98
99
100
101
102
103
104
88105
89106
90107
......
94111
95112
96113
97
98
99
100
114
115
116
117
118
119
120
121
122
123
101124
125
102126
103127
104128
......
106130
107131
108132
109
110133
111
112
113
114
134
135
136
137
138
139
140
141
142
143
115144
116145
117146
OPTIM = -Os -Oz
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) -fno-stack-protector \
-march=pentium4 -msse2 -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
CPPFLAGS := $(CPPFLAGS) -nostdinc++ -include $(SRCROOT)/autoconf.h
DATA_ADDR = $(shell printf "%d" `otool -l $(SYMROOT)/boot.sys | grep __data -A 4 | grep __DATA -A 3 | head -n 2 | tail -n 1 | cut -f 8 -d " "`)
PATCH_ADDR = $(shell echo ${SYMBOL_ADDR}-${DATA_ADDR}+${DATA_OFFSET} | bc)
#### NOTE #### This value is currently *not* calculated and *should* be. It is currently determined experimentally…
DATA_PAD = 3582
all: $(DIRS_NEEDED) boot all-recursive
endif
@${MKDIRS} $(OBJROOT)/../boot2_modules/
@### First pass, don't worry abount segment alignment.
@echo "\t[LD] boot.sys"
@$(BINROOT)/ld_classic -static -segalign 20 -segaddr __INIT $(BOOT2ADDR) -preload \
-arch i386 -e boot2 \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) `find /usr/llvm-gcc-*/lib/gcc/*/*/ -name \libcc_kext.a`
@$(CC) -Wl,-preload -Wl,-alias,boot2,start \
-nostdlib -arch i386 -Wl,-pie \
-Wl,-read_only_relocs,suppress \
-lcc_kext \
$(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) \
-o ${SYMROOT}/$@.sys
@echo "\t[LD] boot.sys"
@$(CC) -Wl,-preload -Wl,-alias,boot2,start \
-nostdlib -arch i386 -Wl,-pie \
-Wl,-segaddr,__INIT,`echo obase=16\; $$((0x${BOOT2ADDR})) | bc` \
-Wl,-segaddr,__TEXT,`echo obase=16\; $$((0x${BOOT2ADDR})) + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __INIT\` | bc` \
-Wl,-segaddr,__DATA,`echo obase=16\; $$((0x${BOOT2ADDR})) + 3582 + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __INIT\` + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __TEXT\` | bc` \
-Wl,-read_only_relocs,suppress \
-lcc_kext \
$(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) \
-o ${SYMROOT}/$@.sys
ifeq (${CONFIG_MODULES}, y)
@cp $(SYMROOT)/boot.sys $(SYMROOT)/boot2.sys
@$(SYMROOT)/dyldsymboltool $(SYMROOT)/boot.sys $(SYMROOT)/${SYMBOLS_MODULE}
@echo "\t[LD] boot.sys"
@$(BINROOT)/ld_classic -static -segalign 20 -segaddr __INIT $(BOOT2ADDR) -preload \
-arch i386 -e boot2\
-sectcreate __DATA __Symbols $(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) `find /usr/llvm-gcc-*/lib/gcc/*/*/ -name \libcc_kext.a`
@$(CC) -Wl,-preload -Wl,-alias,boot2,start \
-nostdlib -arch i386 -Wl,-pie \
-Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \
-Wl,-segaddr,__INIT,`echo obase=16\; $$((0x${BOOT2ADDR})) | bc` \
-Wl,-segaddr,__TEXT,`echo obase=16\; $$((0x${BOOT2ADDR})) + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __INIT\` | bc` \
-Wl,-segaddr,__DATA,`echo obase=16\; $$((0x${BOOT2ADDR})) + 3582 + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __INIT\` + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __TEXT\` | bc` \
-Wl,-read_only_relocs,suppress \
-lcc_kext \
$(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) \
-o ${SYMROOT}/$@.sys
@# Second pass, fixup global var locations
@${RM} $(SYMROOT)/${SYMBOLS_MODULE}
@echo "\t[dyldsymboltool] Symbols.dylib"
@$(SYMROOT)/dyldsymboltool $(SYMROOT)/boot.sys $(SYMROOT)/${SYMBOLS_MODULE}
@${RM} $(SYMROOT)/boot.sys
@echo "\t[LD] boot.sys"
@$(BINROOT)/ld_classic -static -segalign 20 -segaddr __INIT $(BOOT2ADDR) -preload \
-arch i386 \
-sectcreate __DATA __Symbols $(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) `find /usr/llvm-gcc-*/lib/gcc/*/*/ -name \libcc_kext.a`
@$(CC) -Wl,-preload -Wl,-alias,boot2,start \
-nostdlib -arch i386 -Wl,-pie \
-Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \
-Wl,-segaddr,__INIT,`echo obase=16\; $$((0x${BOOT2ADDR})) | bc` \
-Wl,-segaddr,__TEXT,`echo obase=16\; $$((0x${BOOT2ADDR})) + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __INIT\` | bc` \
-Wl,-segaddr,__DATA,`echo obase=16\; $$((0x${BOOT2ADDR})) + 3582 + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __INIT\` + \`${SYMROOT}/segsize ${SYMROOT}/$@.sys __TEXT\` | bc` \
-Wl,-read_only_relocs,suppress \
-lcc_kext \
$(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) \
-o ${SYMROOT}/$@.sys
@${RM} $(SYMROOT)/${SYMBOLS_MODULE}
trunk/i386/Cconfig
88
99
1010
11
12
13
14
15
16
17
18
19
20
21
2211
2312
2413
---help---
Specify the level to compile chameleon with.
config USE_GCC
bool "Use GCC"
default y
help
Say Y here if you want to compile the project with gcc (if available).
Set this to N, can be usefull to debug the project with the clang-static-analizer,
or simply to use the default compiler.
When in doubt, say "Y".
source "i386/md/Cconfig"
source "i386/util/Cconfig"
source "i386/boot0/Cconfig"
trunk/i386/modules/MakeInc.dir
2121
2222
2323
24
24
2525
2626
2727
......
3333
3434
3535
36
36
3737
3838
3939
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) -fno-stack-protector \
-march=pentium4 -msse2 -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
CPPFLAGS := $(CPPFLAGS) -arch i386 -static -nostdinc++ -Wmost -Werror \
CPPFLAGS := $(CPPFLAGS) -arch i386 -static -nostdinc -Wmost -Werror \
-fno-builtin -fno-stack-protector \
-march=pentium4 -msse2 -msoft-float \
-arch i386 -include $(SRCROOT)/autoconf.h
-march=pentium4 -msse2 -msoft-float \
-arch i386 -include $(SRCROOT)/autoconf.h
CPPFLAGS := $(CPPFLAGS) -nostdinc++ -Wmost -Werror \
CPPFLAGS := $(CPPFLAGS) -nostdinc -Wmost -Werror \
-fno-builtin -fno-stack-protector \
-march=pentium4 -msse2 -msoft-float \
-arch i386 -include $(SRCROOT)/autoconf.h
trunk/i386/modules/Keylayout/layouts/Makefile
88
99
1010
11
11
1212
1313
1414
......
3030
3131
3232
33
33
3434
3535
36
36
3737
3838
3939
INC = -I$(SRCROOT)/i386/libsaio/ -I. -I..
OBJS = cham-mklayout.o32_nodep cham-mklayout.o64_nodep #in case we use our own md, we can't make these files with the standard rules, it too early, md doesn't even exist
OBJS = cham-mklayout.o32 cham-mklayout.o64
OBJS := $(addprefix $(OBJROOT)/, $(OBJS))
$(PROGRAMS): $(OBJS)
@echo "\t[LD32] $(@F)_32"
@$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) -arch i386 \
-o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32_nodep
-o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32
@echo "\t[LD64] $(@F)_64"
@$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) -arch x86_64 \
-o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64_nodep
-o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64
@echo "\t[LIPO] $(@F)"
@lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 \
-output $(SYMROOT)/$(@F)
trunk/i386/Makefile
1818
1919
2020
21
22
23
24
2521
2622
2723
# The order of building is important.
SUBDIRS_PRE =
ifeq ($(CONFIG_MD),y)
SUBDIRS_PRE += md
endif
SUBDIRS_PRE += util
SUBDIRS = $(SUBDIRS_PRE) klibc libsa libsaio boot0 boot1 boot2 cdboot modules
trunk/Make.rules
1010
1111
1212
13
14
15
16
13
14
15
1716
1817
1918
......
4140
4241
4342
44
45
46
43
4744
48
49
50
51
52
53
54
55
56
57
58
59
60
6145
6246
63
64
65
47
48
6649
6750
6851
69
70
71
52
53
7254
73
74
75
76
77
7855
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
9956
10057
58
10159
10260
103
104
105
106
107
108
109
110
11161
11262
63
11364
11465
11566
11667
68
11769
11870
11971
12072
121
73
74
12275
12376
12477
125
78
79
12680
127
128
12981
13082
13183
endif
AS = as
LD = ld
ifeq ($(CONFIG_USE_GCC),y)
CC = gcc
CPP = g++
endif
CC = cc
CPP = c++
PAX = /bin/pax
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
#OMIT_FRAME_POINTER_CFLAG=-fomit-frame-pointer
OMIT_FRAME_POINTER_CFLAG=
$(OBJROOT)/%.o32_nodep: %.c
@echo "\t[CC32] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@
-include $(OBJROOT)/*.Makedep
$(OBJROOT)/%.o64_nodep: %.c
@echo "\t[CC64] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@
ifeq ($(CONFIG_MD),y)
$(OBJROOT)/%.o: %.c
@echo "\t[CC] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.o32: %.c
@echo "\t[CC32] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@
$(OBJROOT)/%.o64: %.c
@echo "\t[CC64] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@
$(OBJROOT)/%.o: %.m
@echo "\t[M] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.o: %.cpp
@echo "\t[CPP] $<"
@$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/boot2.o:
@echo "\t[AS] boot2.s"
@$(CC) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \
-MD -dependency-file $*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $*.d
$(OBJROOT)/%.o: %.s
@echo "\t[AS] $<"
@$(CC) $(CPPFLAGS) -c $(INC) -arch i386 -o $@ $< \
-MD -dependency-file $*.d
@$(SYMROOT)/md -u $(OBJROOT)/Makedep -f -d $*.d
else
$(OBJROOT)/%.o: %.c
@echo "\t[CC] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@
$(OBJROOT)/%.o32: %.c
@echo "\t[CC32] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@
$(OBJROOT)/%.o64: %.c
@echo "\t[CC64] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@
$(OBJROOT)/%.o: %.m
@echo "\t[M] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@
$(OBJROOT)/%.o: %.cpp
@echo "\t[CPP] $<"
@$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -MM -M -o $@.Makedep
@$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@
$(OBJROOT)/boot2.o:
@echo "\t[AS] boot2.s"
@$(CC) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s
@$(CC) -Wa,-n -c $(INC) -arch i386 boot2.s -MM -M -o $@.Makedep
@$(CC) -Wa,-n -c $(INC) -arch i386 boot2.s -o $(OBJROOT)/$(@F)
$(OBJROOT)/%.o: %.s
@echo "\t[AS] $<"
@$(CC) $(CPPFLAGS) -c $(INC) -arch i386 -o $@ $<
@$(CC) $(CPPFLAGS) -c $(INC) -arch i386 $< -MM -M -o $@.Makedep
@$(CC) $(CPPFLAGS) -c $(INC) -arch i386 $< -o $@
endif
CONFIG_FILES=$(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h $(SRCROOT)/autoconf.inc $(SRCROOT)/.config
$(CONFIG_FILES): $(SRCROOT)/.config
@echo "\t[MAKE] config"

Archive Download the corresponding diff file

Revision: 2090