can I build binutil with elf32-tradlittlemips support

loody miloody@gmail.com
Mon Nov 23 06:06:00 GMT 2009


Hi all:

2009/11/23 loody <miloody@gmail.com>:
> Hi all:
>
> I have something wired and I have no idea whether it comes with
> elf32-littlemips and elf32-tradlittlemips these 2 different mips link
> format.
>
> 1. I have 2 mips-toolchains, tool A, one support elf32-tradlittlemips
> with gcc 3.4.4, and, tool B, generated by cross-ng which support
> elf32-littlemips with gcc4.2.1.
> 2. I compile my test program with these 2 toolchain with "-c -g "
> option, and i can see source codes embedded in *.o, the elf output I
> build.
> 3. but after I use linker to link them together, I can see the source
> codes embedded in the final ELF output with tool A build, but tool B
> cannot.
>
> I know the version of these toolchains is quite different, 4.2.1 vs 3.4.4.
> But everything seems fine before final linking, and the parameters i
> pass to ld are the same, except the output format they support.
>
> Is there any document or steps can tell me how to generate binutils
> which supports elf32-tradlittlemips such that I can do the comparison,
> since i cannot see any setting about these 2 format in ct-ng
> menuconfig.
>
> I attach my result and commands at the end of letter for your reference.
> appreciate your help,
> miloody
>
>
> /* source codes not embedded in the elf*/
> 80000298 <main>:
> 80000298:       27bdffd8        addiu   sp,sp,-40
> 8000029c:       afbf0024        sw      ra,36(sp)
> 800002a0:       afbe0020        sw      s8,32(sp)
> 800002a4:       03a0f021        move    s8,sp
> 800002a8:       24020017        li      v0,23
> 800002ac:       afc20018        sw      v0,24(s8)
> 800002b0:       24020020        li      v0,32
> 800002b4:       afc20014        sw      v0,20(s8)
> 800002b8:       2402002c        li      v0,44
> 800002bc:       afc20010        sw      v0,16(s8)
> 800002c0:       8fc30018        lw      v1,24(s8)
> 800002c4:       8fc20014        lw      v0,20(s8)
> 800002c8:       00621821        addu    v1,v1,v0
> 800002cc:       8fc20010        lw      v0,16(s8)
> 800002d0:       00621021        addu    v0,v1,v0
> 800002d4:       afc20018        sw      v0,24(s8)
> 800002d8:       24040100        li      a0,256
> 800002dc:       0c0000d8        jal     80000360 <malloc>
> 800002e0:       00000000        nop
> 800002e4:       afc2001c        sw      v0,28(s8)
> 800002e8:       0c00009e        jal     80000278 <newline>
> 800002ec:       00000000        nop
> 800002f0:       03c0e821        move    sp,s8
> 800002f4:       8fbf0024        lw      ra,36(sp)
> 800002f8:       8fbe0020        lw      s8,32(sp)
> 800002fc:       27bd0028        addiu   sp,sp,40
>
> /*source code is embedded in elf*/
> int main()
> //int c_entry()
> {
>  90:   27bdffd8        addiu   sp,sp,-40
>  94:   afbf0024        sw      ra,36(sp)
>  98:   afbe0020        sw      s8,32(sp)
>  9c:   03a0f021        move    s8,sp
> char * point;
> int a,b,c;
> a =23;
>  a0:   24020017        li      v0,23
>  a4:   afc20018        sw      v0,24(s8)
> b = 32;
>  a8:   24020020        li      v0,32
>  ac:   afc20014        sw      v0,20(s8)
> c = 44;
>  b0:   2402002c        li      v0,44
>  b4:   afc20010        sw      v0,16(s8)
> a = a+b+c;
>  b8:   8fc30018        lw      v1,24(s8)
>  bc:   8fc20014        lw      v0,20(s8)
>  c0:   00621821        addu    v1,v1,v0
>  c4:   8fc20010        lw      v0,16(s8)
>  c8:   00621021        addu    v0,v1,v0
>  cc:   afc20018        sw      v0,24(s8)
>
> /*my commands that I can see source */
> mipsel-unknown-elf-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -D_ASSEMBLER_  -c
> init.S
> mipsel-unknown-elf-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -D_ASSEMBLER_  -c
> reset.S
> mipsel-unknown-elf-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -c atexit.c
> mipsel-unknown-elf-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -c main.c
> mipsel-unknown-elf-ld -T ./link.xn -o TestCode.elf -Map TestCode.map
> --oformat elf32-littlemips  init.o reset.o atexit.o main.o -static
> -nostdlib -L/media/sdb1/newlib-1.17.0/build/mipsel/lib
> -L/root/bare_metal/x-tools/mipsel-unknown-elf/lib/gcc/mipsel-unknown-elf/4.2.4
>  -lc -lnullmon -lgcc
> rm -f TestCode.dla
> rm -f TestCode.dnm
>
> /* commands that I cannot see source
> sde-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -D_ASSEMBLER_  -c
> init.S
> sde-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -D_ASSEMBLER_  -c
> reset.S
> sde-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -c atexit.c
> sde-gcc  -g -G 0 -mips32r2 -fno-omit-frame-pointer
> -fno-optimize-sibling-calls -I./include -I./device/display
> -I./device/fatfs -I./device/misc -I./device/ntstrg -I./device/ntuart
> -I./device/ntxsub -I./device/vpu
> -I/media/sdb1/newlib-1.17.0/build/mipsel/include -c main.c
> sde-ld -T ./link.xn -o TestCode.elf -Map TestCode.map --oformat
> elf32-tradlittlemips  init.o reset.o atexit.o main.o -static -nostdlib
> -L/media/sdb1/newlib-1.17.0/build/mipsel/lib
> -L/root/bare_metal/x-tools/sde/lib/gcc/3.4.4/el  -lc -lnullmon -lgcc
> rm -f TestCode.dla
I find binutil seems give up elf32-littlemips since 2.11.90.04
below is the release note excerpted from binutils
Changes from binutils 2.11.90.0.4:
1. Update from binutils 2001 0414.
2. Fix an ia64 assembler bug.
3. Change Linux/MIPS to use the SVR4 MIPS ABI instead of the IRIX ABI.
since there are no supports for the IRIX ABI in glibc. The current
Linux/MIPS targets are elf64-tradlittlemips for little endian MIPS
instead of elf32-littlemips and elf64-tradbigmips for big endian MIPS
instead of elf32-bigmips. Glibc, gcc and kernel may have to be modified
for this change.

BTW, I use buildroot to generate mips toolchain and the ld really
support elf32-tradlittlemips/elf32-tradbigmips.
I append the output of ld and configure at the end of letter.
My question is :
Is there any additional binutil options I have to set in ct-ng menuconfig?
appreciate your help,
miloody

ld output:
buildroot-2009.05/gcc_4_1__build_mipsel/staging_dir/usr#
./bin/mipsel-linux-ld --verbose
GNU ld (GNU Binutils) 2.17
  Supported emulations:
   elf32ltsmip
   elf32btsmip
   elf32ltsmipn32
   elf64ltsmip
   elf32btsmipn32
   elf64btsmip
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips",
	      "elf32-tradlittlemips")

buildroot binutil configure:
/media/sda6/uclinux/toolchain/mips/temp/buildroot-2009.05/gcc_4_1__toolchain_build_mipsel/binutils-2.19/configure
\
                --prefix=/usr \
                --build=i386-pc-linux-gnu \
                --host=i386-pc-linux-gnu \
                --target=mipsel-linux-uclibc \
                --mandir=/usr/share/man \
                --infodir=/usr/share/info \

--with-sysroot=/media/sda6/uclinux/toolchain/mips/temp/buildroot-2009.05/gcc_4_1__toolchain_build_mipsel/uClibc_dev/
\

--with-sysroot=/media/sda6/uclinux/toolchain/mips/temp/buildroot-2009.05/gcc_4_1__build_mipsel/staging_dir
\
                --disable-nls \
                --disable-multilib \
                --disable-werror \
                --with-float=soft \

--with-gmp="/media/sda6/uclinux/toolchain/mips/temp/buildroot-2009.05/gcc_4_1__toolchain_build_mipsel/gmp"
--with-mpfr="/media/sda6/uclinux/toolchain/mips/temp/buildroot-2009.05/gcc_4_1__toolchain_build_mipsel/mpfr"

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list