Bug: setjmp multilib appears broken

Shaun Jackman sjackman@gmail.com
Fri Jun 2 20:12:00 GMT 2006


I'll test out your patch right now. I thought I'd mention first though
that sh seems to work around this bug as follows:

newlib/libc/machine/sh/Makefile.am:7:
AM_CCASFLAGS = $(INCLUDES) $(CFLAGS)

I added the same hack to ARM and it did workaround the bug. When the
config-ml.in patch is checked, it should probably also revert this sh
hack.

Cheers,
Shaun

On 6/2/06, Jeff Johnston <jjohnstn@redhat.com> wrote:
> The move to the new configure/automake uses $(CCASCOMPILE) for compiling
> .S files into .o files.  This ends up being the same gcc compiler used
> for C files.  However, CCASCOMPILE uses its own set of flags: e.g.
> CCASFLAGS instead of CFLAGS.
>
> Now, config-ml.in which adds the multilib logic gets special multilib
> flags from the compiler and appends them to a set of flags to be passed
> when building a particular multilib.  It adds these flags to CFLAGS, but
> neglects to add them to CCASFLAGS.
>
> I propose the attached patch to fix this.  Shaun, please try it out.
>
> DJ, I cc'd you as you are listed in the MAINTAINERS file for
> config-ml.in.  Ok?
>
> -- Jeff J.
>
> Shaun Jackman wrote:
> > The functions setjmp and longmp in the thumb libc.a are in fact
> > compiled as ARM code.
> >
> > The linker complains when I attempt to link my program.
> >
> > /usr/local/lib/gcc/arm-elf/4.1.0/../../../../arm-elf/bin/ld:
> > /usr/local/lib/gcc/arm-elf/4.1.0/../../../../arm-elf/lib/thumb/libg.a(lib_a-setjmp.o)(longjmp):
> >
> > warning: interworking not enabled.
> >  first occurrence: proc.o: thumb call to arm
> > proc.o: In function `kexit':../../kernel/proc.c:55: warning: internal
> > error: dangerous error
> >
> > $ arm-elf-objdump -rS
> > ./arm-elf/thumb/newlib/libc/machine/arm/lib_a-setjmp.o
> >
> > ./arm-elf/thumb/newlib/libc/machine/arm/lib_a-setjmp.o:     file
> > format elf32-littlearm
> >
> > Disassembly of section .text:
> >
> > 00000000 <setjmp>:
> >   0:   e8a07ff0        stmia   r0!, {r4, r5, r6, r7, r8, r9, sl, fp,
> > ip, sp, lr}
> >   4:   e3a00000        mov     r0, #0  ; 0x0
> >   8:   e31e0001        tst     lr, #1  ; 0x1
> >   c:   01a0f00e        moveq   pc, lr
> >  10:   e12fff1e        bx      lr
> >
> > 00000014 <longjmp>:
> >  14:   e8b07ff0        ldmia   r0!, {r4, r5, r6, r7, r8, r9, sl, fp,
> > ip, sp, lr}
> >  18:   e1b00001        movs    r0, r1
> >  1c:   03a00001        moveq   r0, #1  ; 0x1
> >  20:   e31e0001        tst     lr, #1  ; 0x1
> >  24:   01a0f00e        moveq   pc, lr
> >  28:   e12fff1e        bx      lr
> >
> > Here are the relevant lines from the compilation:
> >
> > make[9]: Entering directory
> > `/home/sjackman/src/toolchain/src/_build/arm-elf/thumb/newlib/libc/machine/arm'
> >
> > arm-elf-gcc -B/home/sjackman/src/toolchain/src/_build/arm-elf/newlib/
> > -isystem
> > /home/sjackman/src/toolchain/src/_build/arm-elf/newlib/targ-include
> > -isystem /home/sjackman/src/toolchain/src/newlib/libc/include -O2
> > -D__NO_SYSCALLS__ -DNO_FLOATING_POINT -DHAVE_FCNTL -DHAVE_GETTIMEOFDAY
> > -DHAVE_NANOSLEEP -fno-builtin    -c -o lib_a-setjmp.o `test -f
> > 'setjmp.S' || echo
> > '../../../../../../../newlib/libc/machine/arm/'`setjmp.S
> > rm -f lib.a
> > arm-elf-ar cru lib.a lib_a-setjmp.o lib_a-access.o
> > arm-elf-ranlib lib.a
> > make[9]: Leaving directory
> > `/home/sjackman/src/toolchain/src/_build/arm-elf/thumb/newlib/libc/machine/arm'
> >
> >
> > It looks as though the option -mthumb has been omitted.
> >
> > Cheers,
> > Shaun
>
>
>
>



More information about the Newlib mailing list