This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM Multilibs with --with-mode=thumb


On Wed, May 8, 2013 at 6:14 PM, gnubie gnubie <gcc.gnubie@gmail.com> wrote:
> Hi,
> I've noticed odd behaviour when building an ARM compiler with GCC 4.7,
> --with-mode=thumb and multilibs enabled.
>
> If I do a standard c/c++ newlib build with the following multilib options:
> MULTILIB_OPTIONS     += marm mthumb
> MULTILIB_DIRNAMES    += arm thumb
>

Watch out the difference between "+=" and "=" when hack the Multilib.
When you configure the gcc with --with-mode=thumb, the default mode is
changed to thumb, thus you need to change the "marm" to "mthumb" in
MULTILIB_DEFAULTS.

Here is a small patch that can help you to implement this:

diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h
index e0a0aa0..d5f2234 100644
--- a/gcc/config/arm/elf.h
+++ b/gcc/config/arm/elf.h
@@ -113,7 +113,7 @@

 #ifndef MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS \
-  { "marm", "mlittle-endian", "mfloat-abi=soft",
"mno-thumb-interwork", "fno-leading-underscore" }
+  { "mthumb", "mlittle-endian", "mfloat-abi=soft",
"mno-thumb-interwork", "fno-leading-underscore" }
 #endif
 ^L
 #define TARGET_ASM_FILE_START_APP_OFF true
diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf
index 25b7acb..e7dda60 100644
--- a/gcc/config/arm/t-arm-elf
+++ b/gcc/config/arm/t-arm-elf
@@ -17,7 +17,7 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.

-MULTILIB_OPTIONS     = marm/mthumb
+MULTILIB_OPTIONS     = marm mthumb
 MULTILIB_DIRNAMES    = arm thumb
 MULTILIB_EXCEPTIONS  =
 MULTILIB_MATCHES     =
@@ -39,9 +39,9 @@ MULTILIB_MATCHES     =
 # Not quite true.  We can support hard-vfp calling in Thumb2, but how do we
 # express that here?  Also, we really need architecture v5e or later
 # (mcrr etc).
-MULTILIB_OPTIONS       += mfloat-abi=hard
-MULTILIB_DIRNAMES      += fpu
-MULTILIB_EXCEPTIONS    += *mthumb/*mfloat-abi=hard*
+#MULTILIB_OPTIONS       += mfloat-abi=hard
+#MULTILIB_DIRNAMES      += fpu
+#MULTILIB_EXCEPTIONS    += *mthumb/*mfloat-abi=hard*
 #MULTILIB_EXCEPTIONS    += *mcpu=fa526/*mfloat-abi=hard*
 #MULTILIB_EXCEPTIONS    += *mcpu=fa626/*mfloat-abi=hard*

At least it works for me. Here is what I got:

terguo01@terry-pc01:install-native$ ls  arm-none-eabi/lib/
arm            libc.a            libnosys.a   libstdc++.a-gdb.py
linux-crt0.o   rdimon.specs    redboot.ld
crt0.o         libg.a            librdimon.a  libstdc++.la
linux.specs    rdpmon-crt0.o   redboot.specs
iq80310.specs  libgloss-linux.a  librdpmon.a  libsupc++.a
pid.specs      rdpmon.specs    redboot-syscalls.o
ldscripts      libm.a            libstdc++.a  libsupc++.la
rdimon-crt0.o  redboot-crt0.o
terguo01@terry-pc01:install-native$ ls  arm-none-eabi/lib/arm
crt0.o         libgloss-linux.a  librdpmon.a         libsupc++.a
pid.specs      rdpmon.specs    redboot-syscalls.o
iq80310.specs  libm.a            libstdc++.a         libsupc++.la
rdimon-crt0.o  redboot-crt0.o
libc.a         libnosys.a        libstdc++.a-gdb.py  linux-crt0.o
rdimon.specs   redboot.ld
libg.a         librdimon.a       libstdc++.la        linux.specs
rdpmon-crt0.o  redboot.specs

BTW. There is an official pre-built tool chain with full
multilib-support for arm-non-eabi at
https://launchpad.net/gcc-arm-embedded.

BR,
Terry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]