Skip to contentSkip to conversation

egcs 1.0.3a-2 crosscompiler behavior

DISCUSSION Brady Brown 2 participants 2 messages Jul 19, 2000 MIPS

lore
Share & tools
lore
#0 lore raw

I have several steps in my build process where I use the linker to link a pure binary file (usually a zipped image) into a relocatable elf file, which is then linked with other elf files to create a final image. I am running the mipsel-linux cross compiler tool chain on an i386. After upgrading the tools to egcs 1.0.3a-2 the linking of this binary file fails.

Example:
mipsel-linux-ld -T link.script -r -b binary image.gz -o image.o

link.script file contents are:
OUTPUT_FORMAT("elf32-littlemips")
OUTPUT_ARCH(mips)
SECTIONS

{
    .data :
    {
        image_start = .;
        *(.data)
        image_end = .;
      }
}

The normal output from the old linker was:
mipsel-linux-ld: image.gz: compiled for a little endian system and target is little endian

The new linker gives:
mipsel-linux-ld: image.gz: compiled for a little endian system and target is big endian
File in wrong format: failed to merge target specific data of file image.gz?
make[1]: *** [image.o] Error 1

I have been unable to figure out why the linker thinks the target is big endian and have yet to find a way to get this to work. Any ideas? --
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brady Brown ([email protected]) Work:(801)619-6103
Texas Instruments: Broadband Access Group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#1 lore raw

Hi Brady,

This is fixed in the current CVS version of binutils. I have no idea what version of ld you are running, but if you look at the function _bfd_mips_elf_merge_private_bfd_data in elf32-mips.c you'll see that the check ibfd->xvec->byteorder != BFD_ENDIAN_UNKOWN is forgotten in the if statement.

Ulf

Quoted 43 lines · Brady Brown

I have several steps in my build process where I use the linker to link a pure binary file (usually a zipped image) into a relocatable elf file, which is then linked with other elf files to create a final image. I am running the mipsel-linux cross compiler tool chain on an i386. After upgrading the tools to egcs 1.0.3a-2 the linking of this binary file fails.

Example:
mipsel-linux-ld -T link.script -r -b binary image.gz -o image.o

link.script file contents are:
OUTPUT_FORMAT("elf32-littlemips")
OUTPUT_ARCH(mips)
SECTIONS

{
    .data :
    {
        image_start = .;
        *(.data)
        image_end = .;
      }
}

The normal output from the old linker was:
mipsel-linux-ld: image.gz: compiled for a little endian system and target is little endian

The new linker gives:
mipsel-linux-ld: image.gz: compiled for a little endian system and target is big endian
File in wrong format: failed to merge target specific data of file image.gz?
make[1]: *** [image.o] Error 1

I have been unable to figure out why the linker thinks the target is big endian and have yet to find a way to get this to work. Any ideas? --
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Brady Brown ([email protected]) Work:(801)619-6103
Texas Instruments: Broadband Access Group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~