* Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
@ 2012-03-26 14:39 Fredrik Hederstierna
2012-03-26 20:53 ` Ian Lance Taylor
2012-03-27 11:42 ` Fredrik Hederstierna
0 siblings, 2 replies; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-26 14:39 UTC (permalink / raw)
To: gcc-help
Hi
We've been using a bare-metal 'arm-elf' cross-compiler toolchain over the years since GCC 2.95.x/GCC3/GCC4, and it has worked fine.
Now it seems though like the 'arm-elf' target seems obsolete, and we are trying to switch to 'arm-none-eabi'.
We use no standard-libs at all, we are really hard bare-metal with our own memcpy() etc.
Now when we try to build GCC 4.7.0 we get errors that LibGCC has dependencies on UnWind stuff we cannot get rid of.
We want to skip unwind support.
We try building toolchain with
--disable-shared --disable-libunwind-exceptions --with-newlib
(--disable-libunwind-exceptions seems obsoleted though)
(We only use newlib for headers only though, we dont use any code from it.)
We compile with flags on all files:
-fno-unwind-tables -fno-excpetions
Still we are getting link errors that LibGCC want to link with unwind-libs, and they are not present in libgcc libfile.
We also tried --with-system-libunwind, but same thing.
So, how can we get rid of all unwind-stuff for a real bare-metal arm-none-eabi cross compiler?
Someone suggested to put
char __aeabi_unwind_cpp_pr0[0];
in a C-file, but then it seems like division-stuff still thinks unwinding is supported and may fail?
(Similar thread at, but does not work for us.
http://gcc.gnu.org/ml/gcc-help/2009-10/msg00302.html)
Thanks and Best Regards,
Fredrik Hederstierna
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-26 14:39 Bare metal ARM Cross compiler for arm-none-eabi target without libunwind? Fredrik Hederstierna
@ 2012-03-26 20:53 ` Ian Lance Taylor
2012-03-27 11:42 ` Fredrik Hederstierna
1 sibling, 0 replies; 15+ messages in thread
From: Ian Lance Taylor @ 2012-03-26 20:53 UTC (permalink / raw)
To: Fredrik Hederstierna; +Cc: gcc-help
Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com> writes:
> Now when we try to build GCC 4.7.0 we get errors that LibGCC has dependencies on UnWind stuff we cannot get rid of.
Please always tell us the exact error messages. When we have to guess
what is going wrong, we often guess wrong.
In fact in this case I can't even guess. It's true that libgcc includes
code for stack unwinding, but I can't think of any reason why that
should matter when you are building gcc.
Ian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-26 14:39 Bare metal ARM Cross compiler for arm-none-eabi target without libunwind? Fredrik Hederstierna
2012-03-26 20:53 ` Ian Lance Taylor
@ 2012-03-27 11:42 ` Fredrik Hederstierna
2012-03-27 13:30 ` Ian Lance Taylor
` (6 more replies)
1 sibling, 7 replies; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-27 11:42 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-help
Hi
Sorry I maybe did not describe my problem clear enough.
It is not primary the gcc-toolchain that doesn't build.
It is the built bare metal arm libgcc that does not contain all symbols, and does not link with out compiled binary.
This is what the linker output
Linking sniffer2.elf ..
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `get_eit_entry':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:275: undefined reference to `__exidx_start'
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:275: undefined reference to `__exidx_end'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `unwind_phase2_forced':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:319: undefined reference to `memcpy'
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:346: undefined reference to `memcpy'
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:376: undefined reference to `memcpy'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `unwind_phase2':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:289: undefined reference to `abort'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `__gnu_Unwind_RaiseException':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:420: undefined reference to `memcpy'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `__gnu_Unwind_Resume':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:505: undefined reference to `abort'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `__gnu_Unwind_Backtrace':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/unwind-arm-common.inc:560: undefined reference to `memcpy'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o): In function `_Unwind_GetDataRelBase':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/config/arm/pr-support.c:394: undefined reference to `abort'
/usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o): In function `_Unwind_GetTextRelBase':
/home/fredrikh/arm_toolchain/toolchain-4.7.0/build/gcc/arm-none-eabi/thumb/libgcc/../../../../../gcc-4.7.0/libgcc/config/arm/pr-support.c:400: undefined reference to `abort'
make[1]: *** [../../../build/sniffer2/sniffer2.elf] Error 1
make[1]: Leaving directory `/home/fredrikh/workspace/product/app/sniffer2'
make: *** [all] Error 2
The first problem with __exidx_start we could try workaround by adding a few lines to linker-script.
__exidx_start = .;
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
__exidx_end = .;
But since we have an extreme bare metal system with custom memcpy(), no abort() etc,
the libgcc does not link.
We've tried to compile all files without unwind info nor exceptions.
If we build toolchain with 'arm-elf' taget instead, it works fine.
I submit script to build non-working toolchain.
If we just change to "TARGET=arm-none-elf" instead and add "--enable-obsolete" to configure, then it works fine.
It seems to TARGET=arm-none-eabi" introduces dependencies of libc functions like memcpy() and abort() that did not excist in previous versions.
Also I don't understand how I could work-around these dependencies or get rid of them.
------------- SCRIPT START BUILD TOOLCHAIN ARM EABI -------------
#!/bin/sh
set -e -x
TARGET=arm-none-eabi
BINUTILS_VERSION=2.22
GCC_VERSION=4.7.0
NEWLIB_VERSION=1.20.0
DEST="/usr/local/gcc/arm-elf-tools-$GCC_VERSION"
BINUTILS_DIR="binutils-$BINUTILS_VERSION"
GCC_DIR="gcc-$GCC_VERSION"
NEWLIB_DIR="newlib-$NEWLIB_VERSION"
# set rwx access
umask 022
# unpack tar-balls
rm -fr "$BINUTILS_DIR" "$GCC_DIR" "$NEWLIB_DIR"
tar xvjf "binutils-$BINUTILS_VERSION.tar.bz2"
tar xvjf "gcc-$GCC_VERSION.tar.bz2"
tar xvzf "newlib-$NEWLIB_VERSION.tar.gz"
cd "$GCC_DIR"
ln -s "../$NEWLIB_DIR/newlib" newlib
ln -s "../$NEWLIB_DIR/libgloss" libgloss
cd ..
rm -fr build
mkdir -p build/binutils build/gcc build/newlib
# Build binutils
cd build/binutils
"../../$BINUTILS_DIR/configure" --target="$TARGET" --prefix="$DEST" --disable-nls
make LDFLAGS=-s all install
# Build GCC
cd ../gcc
PATH="$DEST/bin:$PATH"
"../../$GCC_DIR/configure" --enable-languages=c --target="$TARGET" --prefix="$DEST" --with-gnu-as --with-gnu-ld --disable-nls --disable-shared --with-newlib --disable-libunwind-exceptions --enable-target-optspace
make LDFLAGS=-s all all-gcc install install-gcc
# Remove uncompressed sources
cd ../..
rm -fr "$BINUTILS_DIR" "$GCC_DIR" "$NEWLIB_DIR" build
------------- SCRIPT END -------------
Thanks and Best Regards/Fredrik
-----Ian Lance Taylor <iant@google.com> wrote: -----
>To: Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com>
>From: Ian Lance Taylor <iant@google.com>
>Date: 03/26/2012 10:53PM
>Cc: gcc-help@gcc.gnu.org
>Subject: Re: Bare metal ARM Cross compiler for arm-none-eabi target
>without libunwind?
>
>Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com>
>writes: > Now when we try to build GCC 4.7.0 we get errors that
>LibGCC has dependencies on UnWind stuff we cannot get rid of. Please
>always tell us the exact error messages. When we have to guess what
>is going wrong, we often guess wrong. In fact in this case I can't
>even guess. It's true that libgcc includes code for stack unwinding,
>but I can't think of any reason why that should matter when you are
>building gcc. Ian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
@ 2012-03-27 13:30 ` Ian Lance Taylor
2012-03-28 7:10 ` Fredrik Hederstierna
` (5 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Ian Lance Taylor @ 2012-03-27 13:30 UTC (permalink / raw)
To: Fredrik Hederstierna; +Cc: gcc-help
Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com> writes:
> /usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `get_eit_entry':
You need to find out why unwind-arm.o is being included in your link.
You could easily remove it from libgcc.a, but that would just leave you
with some other undefined symbol. unwind-arm.o is only being pulled in
because it defines some symbol that your program refers to. What
symbol?
If you are using the GNU linker you can find out easily enough by adding
-Wl,-M to your link command. That will produce a map file. The first
part of the file will be a list starting with "Archive member included
because of file (symbol)". Look for the symbol that causes unwind-arm.o
to be included.
Ian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
2012-03-27 13:30 ` Ian Lance Taylor
@ 2012-03-28 7:10 ` Fredrik Hederstierna
2012-03-28 7:15 ` Thomas Martitz
` (2 more replies)
2012-03-28 9:33 ` Fredrik Hederstierna
` (4 subsequent siblings)
6 siblings, 3 replies; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-28 7:10 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-help
Hi
We generate the map-file, the content tells that (if I understand correctly)
"_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
Is it really correct that we need unwind-support if just using division?
Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
(We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
If I declare this symbol myself in a file as
char __aeabi_unwind_cpp_pr0[0];
the binary links successfully, but I'm not sure its 100% working and correct.
(I have some problems with crashes on the new built eabi target, but could also be other reasons.)
----------------MAP FILE----------------
Archive member included because of file (symbol)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_thumb1_case_uqi.o)
../../../build/sniffer2/datetime_utils.o (__gnu_thumb1_case_uqi)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_thumb1_case_uhi.o)
../../../build/sniffer2/radio_cc110x.o (__gnu_thumb1_case_uhi)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivsi3.o)
../../../build/sniffer2/printf.o (__aeabi_uidiv)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divsi3.o)
../../../build/sniffer2/app_start.o (__aeabi_idiv)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_dvmd_tls.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivsi3.o) (__aeabi_idiv0)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_aeabi_ldivmod.o)
../../../build/sniffer2/91x_uart.o (__aeabi_ldivmod)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_aeabi_uldivmod.o)
../../../build/sniffer2/sleep.o (__aeabi_uldivmod)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_muldi3.o)
../../../build/sniffer2/sleep.o (__aeabi_lmul)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(bpabi.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_aeabi_ldivmod.o) (__gnu_ldivmod_helper)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divdi3.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(bpabi.o) (__divdi3)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivdi3.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(bpabi.o) (__udivdi3)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divdi3.o) (__aeabi_unwind_cpp_pr0)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o) (restore_core_regs)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o) (__gnu_unwind_execute)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_clzsi2.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divdi3.o) (__clzsi2)
-------------//...//-------------
.ARM.extab 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divdi3.o)
.data 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivdi3.o)
.bss 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivdi3.o)
.ARM.extab 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivdi3.o)
.data 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.bss 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_info 0x00000000 0x1d4c /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_abbrev 0x00000000 0x448 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_loc 0x00000000 0x19a4 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_aranges
0x00000000 0x20 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_ranges 0x00000000 0x60 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_line 0x00000000 0x46c /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_str 0x00000000 0xb6c /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.comment 0x00000000 0x12 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.ARM.attributes
0x00000000 0x32 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.debug_frame 0x00000000 0x2d0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.data 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.bss 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.ARM.attributes
0x00000000 0x1e /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.debug_line 0x00000000 0xb4 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.debug_info 0x00000000 0xa8 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.debug_abbrev 0x00000000 0x14 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.debug_aranges
0x00000000 0x20 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
.data 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.bss 0x00000000 0x0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_info 0x00000000 0x928 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_abbrev 0x00000000 0x25a /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_loc 0x00000000 0x720 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_aranges
0x00000000 0x20 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_ranges 0x00000000 0x30 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_line 0x00000000 0x17a /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_str 0x00000000 0x4ef /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.comment 0x00000000 0x12 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.ARM.attributes
0x00000000 0x32 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
.debug_frame 0x00000000 0x100 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
-------------//...//-------------
*fill* 0x00008852 0x2 00
.text 0x00008854 0x9c0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
0x00008b04 _Unwind_GetCFA
0x00008b08 __gnu_Unwind_RaiseException
0x00008b68 __gnu_Unwind_ForcedUnwind
0x00008b80 __gnu_Unwind_Resume
0x00008bc8 __gnu_Unwind_Resume_or_Rethrow
0x00008be6 _Unwind_Complete
0x00008be8 _Unwind_DeleteException
0x00008bfe _Unwind_VRS_Get
0x00008c4c _Unwind_VRS_Set
0x00008f20 __aeabi_unwind_cpp_pr2
0x00008f2e __aeabi_unwind_cpp_pr1
0x00008f3c __aeabi_unwind_cpp_pr0
0x00008f4a __gnu_Unwind_Backtrace
0x00008fbc _Unwind_VRS_Pop
.text 0x00009214 0x1d8 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
0x00009214 __restore_core_regs
0x00009214 restore_core_regs
0x00009230 __gnu_Unwind_Restore_VFP
0x00009238 __gnu_Unwind_Save_VFP
0x00009240 __gnu_Unwind_Restore_VFP_D
0x00009248 __gnu_Unwind_Save_VFP_D
0x00009250 __gnu_Unwind_Restore_VFP_D_16_to_31
0x00009258 __gnu_Unwind_Save_VFP_D_16_to_31
0x00009260 __gnu_Unwind_Restore_WMMXD
0x000092a4 __gnu_Unwind_Save_WMMXD
0x000092e8 __gnu_Unwind_Restore_WMMXC
0x000092fc __gnu_Unwind_Save_WMMXC
0x00009310 ___Unwind_RaiseException
0x00009310 _Unwind_RaiseException
0x0000933c ___Unwind_Resume
0x0000933c _Unwind_Resume
0x00009368 _Unwind_Resume_or_Rethrow
0x00009368 ___Unwind_Resume_or_Rethrow
0x00009394 ___Unwind_ForcedUnwind
0x00009394 _Unwind_ForcedUnwind
0x000093c0 _Unwind_Backtrace
0x000093c0 ___Unwind_Backtrace
.text 0x000093ec 0x35c /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
0x00009442 __gnu_unwind_execute
0x000096ec __gnu_unwind_frame
0x00009716 _Unwind_GetRegionStart
0x00009724 _Unwind_GetLanguageSpecificData
0x0000973c _Unwind_GetDataRelBase
0x00009742 _Unwind_GetTextRelBase
-------------//...//-------------
.ARM.exidx 0x040004c0 0xf0 load address 0x0000a6f4
.ARM.exidx 0x040004c0 0x8 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divdi3.o)
.ARM.exidx 0x040004c8 0x8 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivdi3.o)
.ARM.exidx 0x040004d0 0xa8 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
0xd8 (size before relaxing)
.ARM.exidx 0x04000578 0x38 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
0x48 (size before relaxing)
.ARM.extab 0x040005b0 0x78 load address 0x0000a7e4
.ARM.extab 0x040005b0 0x54 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
.ARM.extab 0x04000604 0x24 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
-------------//...//-------------
_Unwind_Backtrace /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
_Unwind_Complete /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
_Unwind_DeleteException /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
_Unwind_ForcedUnwind /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
_Unwind_GetCFA /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
_Unwind_GetDataRelBase /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
_Unwind_GetLanguageSpecificData /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
_Unwind_GetRegionStart /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
_Unwind_GetTextRelBase /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
_Unwind_RaiseException /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
_Unwind_Resume /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
_Unwind_Resume_or_Rethrow /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
_Unwind_VRS_Get /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
_Unwind_VRS_Pop /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
_Unwind_VRS_Set /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
__FMI_EraseSector ../../../build/sniffer2/crashdump.o
__FMI_WaitForLastOperation ../../../build/sniffer2/crashdump.o
__FMI_WriteHalfWord ../../../build/sniffer2/crashdump.o
__FMI_WriteProtectionCmd ../../../build/sniffer2/crashdump.o
___Unwind_Backtrace /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
___Unwind_ForcedUnwind /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
___Unwind_RaiseException /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
___Unwind_Resume /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
___Unwind_Resume_or_Rethrow /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
-------------//...//-------------
__aeabi_unwind_cpp_pr0 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_udivdi3.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_divdi3.o)
__aeabi_unwind_cpp_pr1 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
__aeabi_unwind_cpp_pr2 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
-------------//...//-------------
__cxa_begin_cleanup /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__cxa_call_unexpected /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__cxa_type_match /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
-------------//...//-------------
__exidx_end /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__exidx_start /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
-------------//...//-------------
__gnu_Unwind_Backtrace /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
__gnu_Unwind_Find_exidx /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_ForcedUnwind /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
__gnu_Unwind_RaiseException /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
__gnu_Unwind_Restore_VFP /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Restore_VFP_D /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Restore_VFP_D_16_to_31 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Restore_WMMXC /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Restore_WMMXD /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Resume /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
__gnu_Unwind_Resume_or_Rethrow /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
__gnu_Unwind_Save_VFP /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Save_VFP_D /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Save_VFP_D_16_to_31 /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Save_WMMXC /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_Unwind_Save_WMMXD /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_ldivmod_helper /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(bpabi.o)
-------------//...//-------------
__gnu_thumb1_case_uqi /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(_thumb1_case_uqi.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_unwind_execute /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
__gnu_unwind_frame /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
__restore_core_regs /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
abort /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(pr-support.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
memcpy /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
restore_core_regs /usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(libunwind.o)
/usr/local/gcc/arm-elf-tools-4.7.0-eabi/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o)
-------------MAP FILE END-------------
Do you have any idea how to proceed?
Thanks!/Fredrik
-----Ian Lance Taylor <iant@google.com> wrote: -----
To: Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com>
From: Ian Lance Taylor <iant@google.com>
Date: 03/27/2012 03:30PM
Cc: gcc-help@gcc.gnu.org
Subject: Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com> writes:
> /usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `get_eit_entry':
You need to find out why unwind-arm.o is being included in your link.
You could easily remove it from libgcc.a, but that would just leave you
with some other undefined symbol. unwind-arm.o is only being pulled in
because it defines some symbol that your program refers to. What
symbol?
If you are using the GNU linker you can find out easily enough by adding
-Wl,-M to your link command. That will produce a map file. The first
part of the file will be a list starting with "Archive member included
because of file (symbol)". Look for the symbol that causes unwind-arm.o
to be included.
Ian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-28 7:10 ` Fredrik Hederstierna
@ 2012-03-28 7:15 ` Thomas Martitz
2012-03-28 7:51 ` Andrew Haley
2012-03-28 14:59 ` Ian Lance Taylor
2 siblings, 0 replies; 15+ messages in thread
From: Thomas Martitz @ 2012-03-28 7:15 UTC (permalink / raw)
To: gcc-help
Am 28.03.2012 09:09, schrieb Fredrik Hederstierna:
> Hi
>
> We generate the map-file, the content tells that (if I understand correctly)
>
> "_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
>
> Is it really correct that we need unwind-support if just using division?
> Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
> (We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
>
> If I declare this symbol myself in a file as
>
> char __aeabi_unwind_cpp_pr0[0];
>
> the binary links successfully, but I'm not sure its 100% working and correct.
> (I have some problems with crashes on the new built eabi target, but could also be other reasons.)
>
>
We (Rockbox) also faced this problem and patch gcc to leave exceptions
out[1].
Best regards.
[1]:
http://git.rockbox.org/?p=www.git;a=blob;f=gcc/rockbox-multilibs-noexceptions-arm-elf-eabi-gcc-4.4.2_1.diff;h=3397153495dbc4486f9a32c024a3264bf66708d3;hb=HEAD
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-28 7:10 ` Fredrik Hederstierna
2012-03-28 7:15 ` Thomas Martitz
@ 2012-03-28 7:51 ` Andrew Haley
2012-03-28 14:59 ` Ian Lance Taylor
2 siblings, 0 replies; 15+ messages in thread
From: Andrew Haley @ 2012-03-28 7:51 UTC (permalink / raw)
To: gcc-help
On 03/28/2012 08:09 AM, Fredrik Hederstierna wrote:
> We generate the map-file, the content tells that (if I understand correctly)
>
> "_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
>
> Is it really correct that we need unwind-support if just using division?
> Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
> (We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
I suspect (but you'll have to check) that this is because _divdi3 is
compiled with exceptions, and this is indeed because division by zero
might throw. The simplest fix is to compile it without exceptions.
The correct fix is to make unwinding work on your platform.
Andrew.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
2012-03-27 13:30 ` Ian Lance Taylor
2012-03-28 7:10 ` Fredrik Hederstierna
@ 2012-03-28 9:33 ` Fredrik Hederstierna
2012-03-28 10:12 ` Sebastian Huber
2012-03-28 10:27 ` Fredrik Hederstierna
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-28 9:33 UTC (permalink / raw)
To: aph; +Cc: gcc-help
>> We generate the map-file, the content tells that (if I understand correctly)
>>
>> "_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
>>
>> Is it really correct that we need unwind-support if just using division?
>> Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
>> (We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
>
>I suspect (but you'll have to check) that this is because _divdi3 is
>compiled with exceptions, and this is indeed because division by zero
>might throw. The simplest fix is to compile it without exceptions.
>The correct fix is to make unwinding work on your platform.
Sorry I don't fully agree, we don't want the unwinding stuff.
We are very short on flash memory, and we do not want to waste bytes on unnecessary code.
Also, why does it work with 'arm-none-elf', shouldn't it be the same regarding __div0?
The correct solution would be to exclude dependency to unwind from _divdi3 when building a bare metal toolchain.
Thanks to Thomas Martitz for the proposed patch.
This patch makes libgcc to be compiled with "-fno-exception" instead of "-fexception".
I propose an even better patch maybe to re-introduce a configure option alike "--disable-libunwind-exceptions" or similar.
This configuration option could control this "-f(no)-exception" flag when compiling GCC toolchain.
Then it could be optional for the developer to be able to exclude the exceptions on a extreme bare metal toolchain.
If you think such a patch would be accepted by the community, I could think of spending some time to fix it myself.
Thanks for you feedback and help, its most appreciated!
/Fredrik Hederstierna
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-28 9:33 ` Fredrik Hederstierna
@ 2012-03-28 10:12 ` Sebastian Huber
0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Huber @ 2012-03-28 10:12 UTC (permalink / raw)
To: gcc-help
On 03/28/2012 11:33 AM, Fredrik Hederstierna wrote:
>
>>> We generate the map-file, the content tells that (if I understand correctly)
>>>
>>> "_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
>>>
>>> Is it really correct that we need unwind-support if just using division?
>>> Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
>>> (We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
>>
>
>> I suspect (but you'll have to check) that this is because _divdi3 is
>> compiled with exceptions, and this is indeed because division by zero
>> might throw. The simplest fix is to compile it without exceptions.
>> The correct fix is to make unwinding work on your platform.
>
> Sorry I don't fully agree, we don't want the unwinding stuff.
> We are very short on flash memory, and we do not want to waste bytes on unnecessary code.
>
> Also, why does it work with 'arm-none-elf', shouldn't it be the same regarding __div0?
> The correct solution would be to exclude dependency to unwind from _divdi3 when building a bare metal toolchain.
For me it is also unclear why we need this division by zero exception in the
bare metal tool chain. See also:
http://gcc.gnu.org/ml/gcc-help/2011-03/msg00149.html
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
` (2 preceding siblings ...)
2012-03-28 9:33 ` Fredrik Hederstierna
@ 2012-03-28 10:27 ` Fredrik Hederstierna
2012-03-28 10:52 ` Sebastian Huber
2012-03-28 10:58 ` Fredrik Hederstierna
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-28 10:27 UTC (permalink / raw)
To: aph; +Cc: gcc-help
-----Fredrik Hederstierna/INT/SE/DIR/SECURITAS wrote: -----
To: aph@redhat.com
From: Fredrik Hederstierna/INT/SE/DIR/SECURITAS
Date: 03/28/2012 11:33AM
Cc: gcc-help@gcc.gnu.org
Subject: Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
>> We generate the map-file, the content tells that (if I understand correctly)
>>
>> "_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
>>
>> Is it really correct that we need unwind-support if just using division?
>> Could it be that _divdi3 can 'throw' division-by-zero 'exception' ?
>> (We have overloaded div0: "void __div0(void) { assert(0); }" so we dont want unwinding here anyway...)
>
>I suspect (but you'll have to check) that this is because _divdi3 is
>compiled with exceptions, and this is indeed because division by zero
>might throw. The simplest fix is to compile it without exceptions.
>The correct fix is to make unwinding work on your platform.
I've been investigating the libgcc sources, what do you think of something alike this solution
Today in "gcc/libgcc/Makefile.in" its filtered on which functions that should be compiled with unwind-info:
# These might cause a divide overflow trap and so are compiled with
# unwinder info.
LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
What if this could be overridden by configuration option?
Eg.
+# Check if we want to exclude unwind support.
+ifeq ($(enable_libunwind_exceptions),yes)
# These might cause a divide overflow trap and so are compiled with
# unwinder info.
LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
+endif
In this case all libgcc will be build 'normally' without extra unwind build stuff?
The 'enable_libunwind_exceptions' have to be set somehow when running 'configure'.
Thanks/Fredrik
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-28 10:27 ` Fredrik Hederstierna
@ 2012-03-28 10:52 ` Sebastian Huber
0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Huber @ 2012-03-28 10:52 UTC (permalink / raw)
To: gcc-help
On 03/28/2012 12:26 PM, Fredrik Hederstierna wrote:
> I've been investigating the libgcc sources, what do you think of something alike this solution
>
> Today in "gcc/libgcc/Makefile.in" its filtered on which functions that should be compiled with unwind-info:
>
> # These might cause a divide overflow trap and so are compiled with
> # unwinder info.
> LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
>
> What if this could be overridden by configuration option?
In addition to that it would be nice if the target configuration can override
this also.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
` (3 preceding siblings ...)
2012-03-28 10:27 ` Fredrik Hederstierna
@ 2012-03-28 10:58 ` Fredrik Hederstierna
2012-03-28 14:58 ` Fredrik Hederstierna
2012-04-12 7:08 ` Fredrik Hederstierna
6 siblings, 0 replies; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-28 10:58 UTC (permalink / raw)
To: Fredrik Hederstierna; +Cc: aph, gcc-help
>I suspect (but you'll have to check) that this is because _divdi3 is
>compiled with exceptions, and this is indeed because division by zero
>might throw. The simplest fix is to compile it without exceptions.
>The correct fix is to make unwinding work on your platform.
I found this on gcc-patches from 2011-11, maybe it does solve something also for ARM?
"[patch, ia64, libgcc] Patch to fix libunwind build on IA64"
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01926.html
The patch is basically modding Makefile.in as:
# Build LIBUNWIND.
-c_flags := -fexceptions
+c_flags := -fno-exceptions
I though think my patch proposal could be interesting though to be able to control it from configure.
Thanks &Best Regards/Fredrik
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
` (4 preceding siblings ...)
2012-03-28 10:58 ` Fredrik Hederstierna
@ 2012-03-28 14:58 ` Fredrik Hederstierna
2012-04-12 7:08 ` Fredrik Hederstierna
6 siblings, 0 replies; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-03-28 14:58 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-help
> /usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `get_eit_entry':
I did a patch in libgcc "Makefile.in" that is very similar to Martin's:
This works:
# Build LIB2_DIVMOD_FUNCS.
+ ifeq ($(enable_libgcc_libunwind_exceptions),yes)
+ LIB2_DIVMOD_CFLAGS := -fexceptions -fnon-call-exceptions
+ else
+ LIB2_DIVMOD_CFLAGS := -fno-exceptions -fno-non-call-exceptions
+ endif
lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c
$(gcc_compile) -DL$* -c $< \
- -fexceptions -fnon-call-exceptions $(vis_hide)
+ $(LIB2_DIVMOD_CFLAGS) $(vis_hide)
libgcc-objects += $(lib2-divmod-o)
ifeq ($(enable_shared),yes)
lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c
$(gcc_s_compile) -DL$* -c $< \
- -fexceptions -fnon-call-exceptions
+ $(LIB2_DIVMOD_CFLAGS)
libgcc-s-objects += $(lib2-divmod-s-o)
endif
It seems to work fine, now I guess some work has to be done to add argument to configure-command line to be truly accepted.
I invented the new argument option 'enable_libgcc_libunwind_exceptions' to not mix-up with the old 'without-libunwind-exceptions'.
(Though I have some problems trying to add new arguments to configure, it does not seem to work fully yet...)
Thanks and Best Regards/Fredrik
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-28 7:10 ` Fredrik Hederstierna
2012-03-28 7:15 ` Thomas Martitz
2012-03-28 7:51 ` Andrew Haley
@ 2012-03-28 14:59 ` Ian Lance Taylor
2 siblings, 0 replies; 15+ messages in thread
From: Ian Lance Taylor @ 2012-03-28 14:59 UTC (permalink / raw)
To: Fredrik Hederstierna; +Cc: gcc-help
Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com> writes:
> We generate the map-file, the content tells that (if I understand correctly)
>
> "_divdi3.o" use "__aeabi_unwind_cpp_pr0" which resides in "unwind-arm.o".
I took a look at an ARM build I happened to have, and it looks like
there is a relocation for that symbol in the ARM.exidx section. Looking
into the compiler and assembler, it looks like that relocation is
generated for every object file compiled with the options -fexceptions
or -funwind-tables. The division routines in libgcc are always compiled
with -fexceptions -fnon-call-exceptions. So that is where this is
coming from.
> If I declare this symbol myself in a file as
>
> char __aeabi_unwind_cpp_pr0[0];
>
> the binary links successfully, but I'm not sure its 100% working and correct.
As far as I can see that should not cause any problems. The only time
it would cause trouble would be if you had a signal handler that was
invoked due to a division by zero, and that signal handler threw an
exception.
The only other approach I see here would be to edit the libgcc Makefile
to remove -fexceptions -fnon-call-exceptions, or otherwise adjust the
source code to change the way these files are compiled.
Ian
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
2012-03-27 11:42 ` Fredrik Hederstierna
` (5 preceding siblings ...)
2012-03-28 14:58 ` Fredrik Hederstierna
@ 2012-04-12 7:08 ` Fredrik Hederstierna
6 siblings, 0 replies; 15+ messages in thread
From: Fredrik Hederstierna @ 2012-04-12 7:08 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-help
Regarding bare-metal ARM cross-compiler toolchain without libunwind.
Patch now proposed to gcc-patches:
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00720.html
Thanks & Best Regards Fredrik
-----Ian Lance Taylor <iant@google.com> wrote: -----
To: Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com>
From: Ian Lance Taylor <iant@google.com>
Date: 03/27/2012 03:30PM
Cc: gcc-help@gcc.gnu.org
Subject: Re: Bare metal ARM Cross compiler for arm-none-eabi target without libunwind?
Fredrik Hederstierna <fredrik.hederstierna@securitas-direct.com> writes:
> /usr/local/gcc/arm-elf-tools-4.7.0/lib/gcc/arm-none-eabi/4.7.0/thumb//libgcc.a(unwind-arm.o): In function `get_eit_entry':
You need to find out why unwind-arm.o is being included in your link.
You could easily remove it from libgcc.a, but that would just leave you
with some other undefined symbol. unwind-arm.o is only being pulled in
because it defines some symbol that your program refers to. What
symbol?
If you are using the GNU linker you can find out easily enough by adding
-Wl,-M to your link command. That will produce a map file. The first
part of the file will be a list starting with "Archive member included
because of file (symbol)". Look for the symbol that causes unwind-arm.o
to be included.
Ian
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2012-04-12 7:08 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26 14:39 Bare metal ARM Cross compiler for arm-none-eabi target without libunwind? Fredrik Hederstierna
2012-03-26 20:53 ` Ian Lance Taylor
2012-03-27 11:42 ` Fredrik Hederstierna
2012-03-27 13:30 ` Ian Lance Taylor
2012-03-28 7:10 ` Fredrik Hederstierna
2012-03-28 7:15 ` Thomas Martitz
2012-03-28 7:51 ` Andrew Haley
2012-03-28 14:59 ` Ian Lance Taylor
2012-03-28 9:33 ` Fredrik Hederstierna
2012-03-28 10:12 ` Sebastian Huber
2012-03-28 10:27 ` Fredrik Hederstierna
2012-03-28 10:52 ` Sebastian Huber
2012-03-28 10:58 ` Fredrik Hederstierna
2012-03-28 14:58 ` Fredrik Hederstierna
2012-04-12 7:08 ` Fredrik Hederstierna
[not found] <OFE8FFC9B8.D391E8D6-ONC12579CF.003966A4-C12579CF.003966BB@LocalDomain>
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).