ARMv7 - Fix compiler and partial compilation
authorJohn Hodge <[email protected]>
Fri, 13 Feb 2015 11:18:48 +0000 (19:18 +0800)
committerJohn Hodge <[email protected]>
Fri, 13 Feb 2015 11:18:48 +0000 (19:18 +0800)
16 files changed:
BuildConf/armv7/Makefile.cfg
Externals/cross-compiler/Makefile
Externals/cross-compiler/patches/binutils/bfd/config.bfd.patch
Externals/cross-compiler/patches/binutils/gas/configure.tgt.patch
Externals/cross-compiler/patches/binutils/ld/Makefile.in.patch
Externals/cross-compiler/patches/binutils/ld/configure.tgt.patch
Externals/cross-compiler/patches/binutils/ld/emulparams/acess2_arm.sh [new file with mode: 0644]
Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch
Externals/cross-compiler/patches/gcc/libgcc/config.host.patch
Makefile.cfg
Usermode/Libraries/crt0.o_src/armv7-crti.S [new file with mode: 0644]
Usermode/Libraries/crt0.o_src/armv7-crtn.S [new file with mode: 0644]
Usermode/Libraries/ld-acess.so_src/Makefile
Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h
Usermode/Libraries/libc++.so_src/include_exp/typeinfo
Usermode/Libraries/libc++.so_src/typeinfo.cc

index a2e4cc5..3180234 100644 (file)
@@ -1,13 +1,9 @@
 
+TRIPLET = arm-pc-acess2
 ARM_CPUNAME = gerneric-armv7
-CC = arm-eabi-gcc -mcpu=$(ARM_CPUNAME)
-AS = arm-eabi-gcc -mcpu=$(ARM_CPUNAME) -c
-CXX = arm-eabi-g++ -mcpu=$(ARM_CPUNAME)
-LD = arm-eabi-ld
-OBJDUMP = arm-eabi-objdump
+#AS = $(TRIPLET)-gcc -mcpu=$(ARM_CPUNAME) -c
 DISASM := $(OBJDUMP) -d -S
 ARCHDIR = armv7
-STRIP = arm-eabi-strip
 
 ASSUFFIX = S
 
index dbb6ad3..b3a489d 100644 (file)
@@ -1,5 +1,6 @@
-
-
+#
+#
+#
 -include ../config.mk
 
 GCC_ARCHIVE:=$(lastword $(sort $(wildcard gcc-*.tar.bz2)))
@@ -16,7 +17,7 @@ ifeq ($(BINUTILS_ARCHIVE),)
  $(error No archive found)
 endif
 
-BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/emulparams/acess2_amd64.sh ld/Makefile.in
+BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/emulparams/acess2_amd64.sh ld/emulparams/acess2_arm.sh ld/Makefile.in
 GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host gcc/config/acess2.opt
 # libstdc++-v3/crossconfig.m4 config/override.m4
 
@@ -25,8 +26,8 @@ GCC_TARGETS := gcc target-libgcc
 # target-libstdc++-v3 
 
 PREFIX := $(OUTDIR)-BUILD
-BDIR_GCC := build-$(ARCH)/gcc
-BDIR_BINUTILS := build-$(ARCH)/binutils
+BDIR_GCC := build-$(ARCH)/gcc/
+BDIR_BINUTILS := build-$(ARCH)/binutils/
 
 .PHONY: all clean binutils gcc include
 
@@ -83,6 +84,7 @@ $(BDIR_GCC)/Makefile: Makefile $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) $(GCC_DIR
 
 $(PREFIX)/bin/$(TARGET)-gcc: $(BDIR_GCC)/Makefile
        @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=all-%) -j $(PARLEVEL)
+       @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC)libstdc++-v3/ all-target-libsupc++ -j $(PARLEVEL)
        @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=install-%)
 
 
index 6b61642..0c01831 100644 (file)
@@ -12,7 +12,7 @@
 +    want64=true
 +    ;;
 +  arm-*-acess2)
-+    targ_defvec=bfd_elf32_arm_vec
-+    targ_selvecs="bfd_elf32_arm_vec"
++    targ_defvec=bfd_elf32_littlearm_vec
++    targ_selvecs="bfd_elf32_bigarm_vec"
 +    ;;
  # END OF targmatch.h
index a024c08..6148df1 100644 (file)
@@ -1,6 +1,7 @@
 --- gas/configure.tgt 2011-07-29 00:00:00.000000 +0000
 +++ gas/configure.tgt 2013-03-01 10:45:00.000000 +0800
-@@ -173,2 +173,3 @@
+@@ -173,2 +173,4 @@
    i386-sequent-bsd*)                  fmt=aout em=dynix ;;
 +  i386-*-acess2*)    fmt=elf ;;
++  arm-*-acess2*)    fmt=elf ;;
    i386-*-beospe*)                     fmt=coff em=pe ;;
index 7643961..becadff 100644 (file)
@@ -1,9 +1,11 @@
 --- ld/Makefile.in
 +++ ld/Makefile.in
-@@ -2627,2 +2627,6 @@
+@@ -2627,2 +2627,8 @@
        ${GENSCRIPTS} elf32xtensa "$(tdir_elf32xtensa)"
 +eacess2_i386.c: $(srcdir)/emulparams/acess2_i386.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 +      ${GENSCRIPTS} acess2_i386 "$(tdir_acess2_i386)"
 +eacess2_amd64.c: $(srcdir)/emulparams/acess2_amd64.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 +      ${GENSCRIPTS} acess2_amd64 "$(tdir_acess2_amd64)"
++eacess2_arm.c: $(srcdir)/emulparams/acess2_arm.sh $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
++      ${GENSCRIPTS} acess2_arm "$(tdir_acess2_arm)"
  eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
index cc3dc88..1d5a485 100644 (file)
@@ -1,7 +1,8 @@
 --- ld/configure.tgt
 +++ ld/configure.tgt
-@@ -167,1 +167,3 @@
+@@ -167,1 +167,4 @@
  i[3-7]86-*-nto-qnx*)    targ_emul=i386nto ;;
 +i[3-7]86-*-acess2*)    targ_emul=acess2_i386 ;;
 +x86_64-*-acess2*)      targ_emul=acess2_amd64 ;;
++arm-*-acess2*)         targ_emul=acess2_arm ;;
 
diff --git a/Externals/cross-compiler/patches/binutils/ld/emulparams/acess2_arm.sh b/Externals/cross-compiler/patches/binutils/ld/emulparams/acess2_arm.sh
new file mode 100644 (file)
index 0000000..87ef5df
--- /dev/null
@@ -0,0 +1,19 @@
+SCRIPT_NAME=elf
+OUTPUT_FORMAT="elf32-littlearm"
+BIG_OUTPUT_FORMAT="elf32-bigarm"
+LITTLE_OUTPUT_FORMAT="elf32-littlearm"
+TEXT_START_ADDR=0x8000
+MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
+TEMPLATE_NAME=elf32
+
+ARCH=arm
+MACHINE=
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
+
+NO_SMALL_DATA=yes
+SEPARATE_GOTPLT=12
+
+ELF_INTERPRETER_NAME=\"/Acess/Libs/ld-acess.so\"
+
index 9c7087a..c6f085e 100644 (file)
@@ -14,7 +14,7 @@
 +  ;;
  *-*-darwin*)
 
-@@ -1192,2 +1196,12 @@
+@@ -1192,2 +1196,17 @@
        ;;
 +i[3-7]86-*-acess2*)
 +      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h newlib-stdint.h acess2.h"
 +      tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h acess2.h"
 +      tmake_file="i386/t-i386elf i386/t-crtstuff t-svr4"
 +      use_fixproto=yes
++      ;;
++arm-*-acess2*)
++      tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h newlib-stdint.h acess2.h arm/aout.h arm/arm.h"
++      tmake_file="arm/t-arm arm/t-arm-elf arm/t-bpabi"
++      use_fixproto=yes
 +      ;;
  i[34567]86-*-elf*)
index e250c60..52725e3 100644 (file)
@@ -1,6 +1,6 @@
 --- libgcc/config.host
 +++ libgcc/config.host
-@@ -523,4 +523,12 @@
+@@ -523,4 +523,18 @@
  x86_64-*-elf*)
        tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
        ;;
 +x86_64-*-acess2*)
 +      extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o crtendT.o"
 +      tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
++      ;;
++arm-*-acess2*)
++      extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o crtendT.o"
++      tmake_file="${tmake_file} arm/t-arm arm/t-elf t-fixedpoint-gnu-prefix arm/t-bpabi t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
++      tm_file="$tm_file arm/bpabi-lib.h"
++      unwind_header=config/arm/unwind-arm.h
 +      ;;
  i[34567]86-*-freebsd*)
 
index 1eedf8e..d12710c 100644 (file)
@@ -2,6 +2,8 @@
 # Acess2 Build Configuration
 #
 
+V ?= @
+
 ACESSDIR := $(dir $(lastword $(MAKEFILE_LIST)))
 ACESSDIR := $(shell cd $(ACESSDIR) && pwd)
 
@@ -17,7 +19,6 @@ xMKDIR := mmd -D s
 # Default build programs
 #CC := gcc
 #LD := ld
-AS := nasm
 DISASM := objdump -d -S
 RM := @rm -f
 STRIP := strip
@@ -42,6 +43,9 @@ CC  = $(COMPILERDIR)bin/$(TRIPLET)-gcc
 CXX = $(COMPILERDIR)bin/$(TRIPLET)-g++
 LD  = $(COMPILERDIR)bin/$(TRIPLET)-ld
 OBJDUMP = $(COMPILERDIR)bin/$(TRIPLET)-objdump
+ ifeq ($(AS),as)
+  AS = $(COMPILERDIR)bin/$(TRIPLET)-gcc -c
+ endif
 endif
 
 ifneq ($(ARCH),host)
diff --git a/Usermode/Libraries/crt0.o_src/armv7-crti.S b/Usermode/Libraries/crt0.o_src/armv7-crti.S
new file mode 100644 (file)
index 0000000..310cd6a
--- /dev/null
@@ -0,0 +1,31 @@
+.section .init
+.global _init
+.type _init, function
+_init:
+#ifdef __thumb__
+       .thumb
+       
+       push    {r3, r4, r5, r6, r7, lr}
+#else
+       .arm
+       mov     ip, sp
+       stmdb   sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
+       sub     fp, ip, #4
+#endif
+       /* gcc will nicely put the contents of crtbegin.o's .init section here. */
+
+.section .fini
+.global _fini
+.type _fini, function
+_fini:
+#ifdef __thumb__
+       .thumb
+       
+       push    {r3, r4, r5, r6, r7, lr}
+#else
+       .arm
+       mov     ip, sp
+       stmdb   sp!, {r3, r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
+       sub     fp, ip, #4
+#endif
+       /* gcc will nicely put the contents of crtbegin.o's .fini section here. */
diff --git a/Usermode/Libraries/crt0.o_src/armv7-crtn.S b/Usermode/Libraries/crt0.o_src/armv7-crtn.S
new file mode 100644 (file)
index 0000000..1c3e111
--- /dev/null
@@ -0,0 +1,41 @@
+.section .init
+       /* gcc will nicely put the contents of crtend.o's .init section here. */
+#ifdef __thumb__
+       .thumb
+       
+       pop     {r3, r4, r5, r6, r7}
+       pop     {r3}
+       mov     lr, r3
+#else
+       .arm
+       
+       sub     sp, fp, #40
+       ldmfd   sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr}
+#endif
+       
+#if defined __THUMB_INTERWORK__ || defined __thumb__
+       bx      lr
+#else
+       mov     pc, lr
+#endif
+
+.section .fini
+       /* gcc will nicely put the contents of crtend.o's .fini section here. */
+#ifdef __thumb__
+       .thumb
+       
+       pop     {r3, r4, r5, r6, r7}
+       pop     {r3}
+       mov     lr, r3
+#else
+       .arm
+       
+       sub     sp, fp, #40
+       ldmfd   sp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, lr}
+#endif
+       
+#if defined __THUMB_INTERWORK__ || defined __thumb__
+       bx      lr
+#else
+       mov     pc, lr
+#endif
index 78aac4b..7ee8a96 100644 (file)
@@ -33,15 +33,16 @@ include ../Makefile.tpl
 # create libld-acess.so
 $(_XBIN): $(_OBJPREFIX)_stublib.o
        @echo [LD] -o -shared libld-acess.so
-       $(LD) -shared -o $@ $<
+       $V$(LD) -shared -o $@ $<
 #      @$(LD) $(LDFLAGS) -o $@ $(OBJ)
 
 
 # Override .ao to look in the object prefix for the source
-$(_OBJPREFIX)arch/$(ARCHDIR).ao_: $(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX)
+$(_OBJPREFIX)arch/$(ARCHDIR).ao_: $(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX) Makefile
        @echo [AS] -o $@
        @mkdir -p $(dir $@)
-       @$(AS) $(ASFLAGS) -o $@ $<
+       #$V$(AS) $(ASFLAGS) -o $@ $<
+       $V$(CC) -c $(ASFLAGS) -o $@ $<
 
 #.PRECIOUS: $(OBJ:%.ao=%.asm)
 
@@ -49,7 +50,7 @@ $(_OBJPREFIX)arch/$(ARCHDIR).ao_: $(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX)
 $(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX): arch/$(ARCHDIR).$(ASSUFFIX).h arch/syscalls.s.h
        @echo [CPP] -o $@
        @mkdir -p $(dir $@)
-       @$(CPP) $(CPPFLAGS) -P -D__ASSEMBLER__ $< -o $@
+       $V$(CPP) $(CPPFLAGS) -P -D__ASSEMBLER__ $< -o $@
 
 $(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX): $(ACESSDIR)/KernelLand/Kernel/include/syscalls.h
 
index 351c841..7e604f1 100644 (file)
@@ -16,7 +16,7 @@ _start:
        
        b _exit
 
-@ Stupid GCC
+// Stupid GCC
 .globl __ucmpdi2
 __ucmpdi2:
        cmp r0, r2
@@ -32,8 +32,8 @@ __ucmpdi2:
        mov r0, #1
        mov pc, lr
 
-@ Well, can't blame it
-@ - Clear the instruction cache
+//@ Well, can't blame it
+// - Clear the instruction cache
 .globl __clear_cache
 __clear_cache:
        svc #0x1001
index fd823db..c8b037c 100644 (file)
@@ -8,6 +8,8 @@
 #ifndef _LIBCXX__TYPEINFO_
 #define _LIBCXX__TYPEINFO_
 
+#include <cstddef>
+
 namespace std {
 
 // Type information class
@@ -21,7 +23,7 @@ public:
        const char* name() const;
        
        // acess
-       bool __is_child(const type_info &, unsigned long&) const;
+       bool __is_child(const type_info &, size_t&) const;
 private:
        type_info (const type_info& rhs);
        type_info& operator= (const type_info& rhs);
index 31907ee..99bfedc 100644 (file)
@@ -71,7 +71,7 @@ bool type_info::is_subclass() const
 }
 
 // Acess-defined
-bool type_info::__is_child(const type_info &poss_child, unsigned long &offset) const
+bool type_info::__is_child(const type_info &poss_child, size_t &offset) const
 {
        _SysDebug("typeids = this:%s , poss_child:%s", typeid(*this).name(), typeid(poss_child).name());
 

UCC git Repository :: git.ucc.asn.au