0

I have two binary files generated via 'objcopy -O binary' from respective ELF files. The ELF files are built with arm-none-linux-gnueabi toolchains; one is from linaro gcc 4.6.2 and other is from codesourcery gcc 4.6.3.

I load the binary files into memory via Uboot. While the one built with Linaro executes as expected the one built with codesourcery crashes (most probably as) there is no error on Uboot prompt but the program seems to hang.

Using 'arm-none-linux-gnueabi-readelf -S' from binutils of respective toolchains does not show much difference between files except for address offsets. Are there any tools/techniques that can help in this kind of situation before I attempt runtime debugging on target.

Thanks!

1
  • Those two compilers are extremely closely related. CodeSourcery had a few patches that Linaro chose not to use. It's probably the different configuration.
    – ams
    Aug 4, 2013 at 17:36

2 Answers 2

2

The difference turned out to be compiler option -munaligned-access. Code Sourcery toolchain enables this by default for ARMv6 and later architectures. http://gcc.gnu.org/gcc-4.7/changes.html

Although this appeared in upstream gcc in 4.7 version, Code Sourcery had added this support earlier in their tool chain.

To figure this out I tracked the data abort exception and then compiled the culprit file with -save-temps options. Comparing intermediate .s file provided the hint.

1

What I can advice you is to compare default flags both compilers were built with:

/path/to/cross-compiler/bin/arm-*-*-gcc -Q -v

And preprocessor definitions:

/path/to/cross-compiler/bin/arm-*-*-gcc -dM -E - < /dev/null

The reason why your code compiled using Linaro GCC works is fact, that it may have some options enabled by default, when CodeSourcery one may have not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.