Jelajahi Sumber

rework gcc optimization flags

gcc uses for some architectures --with-cpu, with others
--with-arch. Add two different symbols for that.
Waldemar Brodkorb 9 tahun lalu
induk
melakukan
a977d7f519
4 mengubah file dengan 27 tambahan dan 12 penghapusan
  1. 8 3
      mk/vars.mk
  2. 2 1
      rules.mk
  3. 11 6
      target/config/Config.in.cpu
  4. 6 2
      toolchain/gcc/Makefile

+ 8 - 3
mk/vars.mk

@@ -107,16 +107,21 @@ TARGET_LDFLAGS:=	-L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
 			-Wl,-O1 -Wl,-rpath -Wl,/usr/lib \
 			-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
 
-ifneq ($(ADK_TARGET_CPU),)
+ifneq ($(ADK_TARGET_GCC_CPU),)
 ifeq ($(ADK_CPU_ARC700),y)
 TARGET_CFLAGS+=		-mcpu=ARC700
 TARGET_CXXFLAGS+=	-mcpu=ARC700
 else
-TARGET_CFLAGS+=		-mcpu=$(ADK_TARGET_CPU)
-TARGET_CXXFLAGS+=	-mcpu=$(ADK_TARGET_CPU)
+TARGET_CFLAGS+=		-mcpu=$(ADK_TARGET_GCC_CPU)
+TARGET_CXXFLAGS+=	-mcpu=$(ADK_TARGET_GCC_CPU)
 endif
 endif
 
+ifneq ($(ADK_TARGET_GCC_ARCH),)
+TARGET_CFLAGS+=		-march=$(ADK_TARGET_GCC_ARCH)
+TARGET_CXXFLAGS+=	-march=$(ADK_TARGET_GCC_ARCH)
+endif
+
 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
 TARGET_LDFLAGS+=	-elf2flt
 endif

+ 2 - 1
rules.mk

@@ -33,7 +33,8 @@ ADK_TARGET_KERNEL:=			$(strip $(subst ",, $(ADK_TARGET_KERNEL)))
 ADK_TARGET_LIBC:=			$(strip $(subst ",, $(ADK_TARGET_LIBC)))
 ADK_TARGET_LIBC_PATH:=			$(strip $(subst ",, $(ADK_TARGET_LIBC_PATH)))
 ADK_TARGET_ENDIAN:=			$(strip $(subst ",, $(ADK_TARGET_ENDIAN)))
-ADK_TARGET_CPU:=			$(strip $(subst ",, $(ADK_TARGET_CPU)))
+ADK_TARGET_GCC_CPU:=			$(strip $(subst ",, $(ADK_TARGET_GCC_CPU)))
+ADK_TARGET_GCC_ARCH:=			$(strip $(subst ",, $(ADK_TARGET_GCC_ARCH)))
 ADK_TARGET_FLOAT:=			$(strip $(subst ",, $(ADK_TARGET_FLOAT)))
 ADK_TARGET_FPU:=			$(strip $(subst ",, $(ADK_TARGET_FPU)))
 ADK_TARGET_ARM_MODE:=			$(strip $(subst ",, $(ADK_TARGET_ARM_MODE)))

+ 11 - 6
target/config/Config.in.cpu

@@ -127,11 +127,13 @@ config ADK_CPU_MIPS32
 	bool
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
+	select ADK_TARGET_CPU_WITH_FPU
 
 config ADK_CPU_MIPS32R2
 	bool
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
+	select ADK_TARGET_CPU_WITH_FPU
 
 config ADK_CPU_MIPS64
 	bool
@@ -277,7 +279,7 @@ config ADK_TARGET_CPU_WITH_3DNOW
 config ADK_TARGET_CPU_WITH_3DNOWEXT
 	bool
 
-config ADK_TARGET_CPU
+config ADK_TARGET_GCC_CPU
 	string
 	default "440" if ADK_CPU_PPC_440
 	default "5208" if ADK_CPU_CF_5208
@@ -299,11 +301,6 @@ config ADK_TARGET_CPU
 	default "i486" if ADK_CPU_I486
 	default "i586" if ADK_CPU_I586
 	default "i686" if ADK_CPU_I686
-	default "loongson2f" if ADK_CPU_LOONGSON2F
-	default "mips32" if ADK_CPU_MIPS32
-	default "mips32r2" if ADK_CPU_MIPS32R2
-	default "mips64" if ADK_CPU_MIPS64
-	default "mips64r2" if ADK_CPU_MIPS64R2
 	default "pentium-m" if ADK_CPU_PENTIUM_M
 	default "powerpc" if ADK_CPU_PPC
 	default "powerpc64" if ADK_CPU_PPC64
@@ -315,6 +312,14 @@ config ADK_TARGET_CPU
 	default "x86-64" if ADK_CPU_X86_64
 	default "xscale" if ADK_CPU_XSCALE
 
+config ADK_TARGET_GCC_ARCH
+	string
+	default "loongson2f" if ADK_CPU_LOONGSON2F
+	default "mips32" if ADK_CPU_MIPS32
+	default "mips32r2" if ADK_CPU_MIPS32R2
+	default "mips64" if ADK_CPU_MIPS64
+	default "mips64r2" if ADK_CPU_MIPS64R2
+
 config ADK_TARGET_CPU_ARCH
 	string
 	default "aarch64" if ADK_TARGET_ARCH_AARCH64 && ADK_little

+ 6 - 2
toolchain/gcc/Makefile

@@ -84,8 +84,12 @@ endif
 #
 # architecture specific
 #
-ifneq ($(ADK_TARGET_CPU),)
-GCC_CONFOPTS+=		--with-cpu=$(ADK_TARGET_CPU)
+ifneq ($(ADK_TARGET_GCC_CPU),)
+GCC_CONFOPTS+=		--with-cpu=$(ADK_TARGET_GCC_CPU)
+endif
+
+ifneq ($(ADK_TARGET_GCC_ARCH),)
+GCC_CONFOPTS+=		--with-arch=$(ADK_TARGET_GCC_ARCH)
 endif
 
 ifneq ($(ADK_TARGET_FLOAT),)