Skip to contentSkip to conversation

gcc: Tweak arm multilib endian patch for baremetal

PATCH In review Richard Purdie 2 participants 2 messages Mar 26, 2015 – Apr 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc: Tweak arm multilib endian patch for baremetal

In a baremetal build, TARGET_ENDIAN_OPTION isn't set leading to build failures. Add in ifdefs to avoid this.

meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch +16 -8
index ba0a227..37c46fc 100644
@@ -11,26 +11,34 @@ Upstream-Status: Pending
  gcc/config/arm/linux-elf.h |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: gcc-4.9-20140316/gcc/config/arm/coff.h
+Index: gcc-4.9.2/gcc/config/arm/coff.h
 ===================================================================
---- gcc-4.9-20140316.orig/gcc/config/arm/coff.h
-+++ gcc-4.9-20140316/gcc/config/arm/coff.h
-@@ -33,7 +33,7 @@
+--- gcc-4.9.2.orig/gcc/config/arm/coff.h
++++ gcc-4.9.2/gcc/config/arm/coff.h
+@@ -32,8 +32,11 @@
+ #define TARGET_DEFAULT (MASK_APCS_FRAME)
  
  #ifndef MULTILIB_DEFAULTS
++#ifndef TARGET_ENDIAN_OPTION
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#endif
  #define MULTILIB_DEFAULTS \
 -  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
 +  { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork" }
  #endif
  
  /* This is COFF, but prefer stabs.  */
-Index: gcc-4.9-20140316/gcc/config/arm/elf.h
+Index: gcc-4.9.2/gcc/config/arm/elf.h
 ===================================================================
---- gcc-4.9-20140316.orig/gcc/config/arm/elf.h
-+++ gcc-4.9-20140316/gcc/config/arm/elf.h
-@@ -112,7 +112,7 @@
+--- gcc-4.9.2.orig/gcc/config/arm/elf.h
++++ gcc-4.9.2/gcc/config/arm/elf.h
+@@ -116,8 +116,11 @@
+ #endif
  
  #ifndef MULTILIB_DEFAULTS
++#ifndef TARGET_ENDIAN_OPTION
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#endif
  #define MULTILIB_DEFAULTS \
 -  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
 +  { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
#1 lore raw
Quoted 6 lines · Richard Purdie

In a baremetal build, TARGET_ENDIAN_OPTION isn't set leading to build failures. Add in ifdefs to avoid this.

We should define it in

gcc/config/arm/linux-eabi.h

something like

gcc/config/arm/linux-eabi.h +4 -0
index 048a062..05f01ca 100644
@@ -51,8 +51,12 @@
    config.gcc for big endian configurations.  */
 #undef  TARGET_LINKER_EMULATION
 #if TARGET_BIG_ENDIAN_DEFAULT
+#define TARGET_ENDIAN_DEFAULT    MASK_BIG_END
+#define TARGET_ENDIAN_OPTION     "mbig-endian"
 #define TARGET_LINKER_EMULATION "armelfb_linux_eabi"
 #else
+#define TARGET_ENDIAN_DEFAULT    0
+#define TARGET_ENDIAN_OPTION     "mlittle-endian"
 #define TARGET_LINKER_EMULATION "armelf_linux_eabi"
 #endif
 
Quoted 51 lines
meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch +1 -1
index ba0a227..37c46fc 100644
@@ -11,26 +11,34 @@ Upstream-Status: Pending
 gcc/config/arm/linux-elf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: gcc-4.9-20140316/gcc/config/arm/coff.h
+Index: gcc-4.9.2/gcc/config/arm/coff.h

===================================================================
---- gcc-4.9-20140316.orig/gcc/config/arm/coff.h
-+++ gcc-4.9-20140316/gcc/config/arm/coff.h
-@@ -33,7 +33,7 @@
+--- gcc-4.9.2.orig/gcc/config/arm/coff.h
++++ gcc-4.9.2/gcc/config/arm/coff.h
+@@ -32,8 +32,11 @@
+ #define TARGET_DEFAULT (MASK_APCS_FRAME)

#ifndef MULTILIB_DEFAULTS
++#ifndef TARGET_ENDIAN_OPTION
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#endif
#define MULTILIB_DEFAULTS \

meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch +2 -2
-  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork" }
+  { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork" }
 #endif
 
 /* This is COFF, but prefer stabs.  */
-Index: gcc-4.9-20140316/gcc/config/arm/elf.h
+Index: gcc-4.9.2/gcc/config/arm/elf.h

===================================================================
---- gcc-4.9-20140316.orig/gcc/config/arm/elf.h
-+++ gcc-4.9-20140316/gcc/config/arm/elf.h
-@@ -112,7 +112,7 @@
+--- gcc-4.9.2.orig/gcc/config/arm/elf.h
++++ gcc-4.9.2/gcc/config/arm/elf.h
+@@ -116,8 +116,11 @@
+ #endif

#ifndef MULTILIB_DEFAULTS
++#ifndef TARGET_ENDIAN_OPTION
++#define TARGET_ENDIAN_OPTION "mlittle-endian"
++#endif
#define MULTILIB_DEFAULTS \

meta/recipes-devtools/gcc/gcc-4.9/0015-arm-Use-TARGET_ENDIAN_OPTION-for-determining-MULTILI.patch +1 -1
-  { "marm", "mlittle-endian", "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }
+  { "marm", TARGET_ENDIAN_OPTION, "mfloat-abi=soft", "mno-thumb-interwork", "fno-leading-underscore" }