This is the mail archive of the gcc-bugs@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]

RE: ARM thumb-interwork libgcc asm functions have no bx


Nick Clifton wrote:

> It sounds like you have a broken build of libgcc.a.

> All the functions in lib1funcs.asm come in two varieties, an ARM
> encoded version and a Thumb encoded version.

Agreed.

> The versions in your
> gcc/libgcc/interwork/*.o should all be the Thumb encoded versions not
> the ARM encoded ones.

[omitted discussion about possible (non-)interworking/Thumb/ARM libgccs]

In any case, libgcc has been compiled for ARM with thumb-interwork and this
has produced a bad library. It should be possible to either compile both ARM
(interworking) and Thumb (interworking) libgccs, or the former should be
detected as a configuration error.

> The building of the Thumb version of the lib1funcs.asm functions is
> controlled by the presence of the __thumb__ define when the library is
> built.  I would guess that this value is not being defined for some
> reason.

I would imagine so.

> The definition of __thumb__  is normally controlled by the
> CPP_ISA_SPEC macro in gcc/config/arm/arm.h which gets added into the
> EXTRA_SPECS macro.  I would check your spec strings to see if this is
> being defined properly.

This was a basically unmodified snapshot with the configuration I gave. I
have checked the file you mention and it seems to do the right thing for
CPP_ISA_SPEC. The problem is that xgcc is not being invoked with -mthumb
(this is removing one of the .o files, then remaking):

make GCC_FOR_TARGET="/omitted/build-gcc/gcc/xgcc -B/omitted/build-gcc/gcc/
-B/usr/local/arm-elf/bin/ -I/usr/local/arm-elf/include" \
  HOST_PREFIX="" HOST_PREFIX_1="loser-" \
  AR_FOR_TARGET="arm-elf-ar" \
  AR_CREATE_FOR_TARGET="arm-elf-ar  rc" \
  AR_FLAGS_FOR_TARGET="" \
  OLDCC="cc" CCLIBFLAGS="-O" CFLAGS="-g -O2" \
  RANLIB_FOR_TARGET="arm-elf-ranlib" \
  RANLIB_TEST_FOR_TARGET="[ -f arm-elf-ranlib ] || ( [ "i686-pc-linux-gnu" =
"arm-unknown-elf" ] && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )" \
  LIBGCC2_CFLAGS="-O2  -DCROSS_COMPILE -DIN_GCC    `echo -g -O2|sed -e
's/-pedantic//g' -e 's/-Wtraditional//g'` -isystem ./include  -Dinhibit_libc
-fno-inline -g1  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED " \
  INCLUDES="-I. -I../../egcs-20000619/gcc -I../../egcs-20000619/gcc/config
-I../
../egcs-20000619/gcc/../include" MAYBE_USE_COLLECT2="" \
  CONFIG_H="" MACHMODE_H="machmode.h machmode.def" \
  LIB1ASMSRC='arm/lib1funcs.asm' \
  -f libgcc.mk all
make[2]: Entering directory `/omitted/build-gcc/gcc'
for d in libgcc interwork libgcc/interwork; do \
  if [ -d $d ]; then true; else mkdir $d; fi \
done
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
/omitted/build-gcc/gcc/xgcc -B/omitted/build-gcc/gcc/
-B/usr/local/arm-elf/bin/ -I/usr/local/arm-elf/include -O2  -DCROSS_COMPILE
-DIN_GCC    -g -O2 -isystem ./include  -Dinhibit_libc -fno-inline -g1
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I../../egcs-20000619/gcc
-I../../egcs-20000619/gc
c/config -I../../egcs-20000619/gcc/../include -mthumb-interwork -DL_udivsi3
-xassembler-with-cpp -c ../../egcs-20000619/gcc/config/arm/lib1funcs.asm -o
libgcc/interwork/_udivsi3.o
cpp: -lang-asm: linker input file unused since linking not done
rm -rf interwork/libgcc.a
[snip]

Note the lack of -mthumb! By the way. is this t-arm-elf incorrect?

CROSS_LIBGCC1 = libgcc1-asm.a
LIB1ASMSRC = arm/lib1funcs.asm
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
_call_via_rX _interwork_call_via_rX

FPBIT = fp-bit.c
DPBIT = dp-bit.c

fp-bit.c: $(srcdir)/config/fp-bit.c
	echo '#define FLOAT' > fp-bit.c
	echo '#ifndef __ARMEB__' >> fp-bit.c
	echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
	echo '#endif' >> fp-bit.c
	cat $(srcdir)/config/fp-bit.c >> fp-bit.c

dp-bit.c: $(srcdir)/config/fp-bit.c
	echo '#ifndef __ARMEB__' > dp-bit.c
	echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
	echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
	echo '#endif' >> dp-bit.c
	cat $(srcdir)/config/fp-bit.c >> dp-bit.c

# these lines added
MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork
MULTILIB_DIRNAMES   += normal interwork
MULTILIB_EXCEPTIONS += *mapcs-26/*mthumb-interwork*

MULTILIB_MATCHES     = mbig-endian=mbe mlittle-endian=mle
EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o

LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib

TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline

> I hope that this help syou to track down your problem.

Well, I just need to work out what to do to get libgcc built with -mthumb.

Giuliano.

ps apologies for the long cc: list

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