Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

GNU C compiler passes the wrong architecture name to the linker. For example gcc helloworld.i throws the error ld: unknown/unsupported architecture name: -arch arm. After some experimenting with LD, it seems armv7 is the architecture I should use. The compiling and assembling operations seem to work fine.

It appears that the compiler collection (iphone-gcc) is designed to work with an older version of the linker provided through the open-source Darwin CC Tools, not the newer LD64 I have installed provided as a stand-alone outside the CC tool collection. Is there any way to tell GCC to pass another architecture to the linker? Passing -Wl,-arch,armv7 or -Xlinker -arch -Xlinker armv7 to GCC gives the same error.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

You shouldn't be upgrading your toolchain piecemeal. The parts have to work together. The GNU tools allow so much variation that it is essential that the pieces be set up to work together, especially for a cross-compiler.

If you need a newer ld for some reason, you should build up a complete toolchain to support it.

share|improve this answer
    
I know, but compiling on Darwin on ARM is kind of messed up as the manufacturer does not officially support the installation and use of such tools. Is there no way at all to tell GCC what architecture to pass to the linker? –  anustart Jun 9 at 14:42
1  
@anustart: Yes. Again: build a gcc that is set up to work with your custom ld. Expecting someone else's gcc to somehow know what your custom ld wants is silly, and attempting to arm-twist it into doing the right thing is misguided. What you have there are two tools that must normally work closely together, but which have purposely been built independently of each other, so no wonder they don't work properly together. –  Warren Young Jun 9 at 16:36

Take @Warren Young's advice and upgrade the rest of the toolchain instead of upgrading just the linker.

For Darwin 9 and later on ARM, the toolchain by CoolStar available from the BigBoss repository is recommended. The toolchain contains LLVM+Clang as a replacement for the outdated iphone-gcc, as well as LD64 and the newer Darwin CC Tools. See the iphone-dev wiki (somewhat outdated) for a more detailed comparison between iphone-gcc and LLVM+Clang.

share|improve this answer

If you use the EasyBuild tool, you can automagically deliver multiple toolchains: https://hpc.uni.lu/users/software/#sw-toolchain
fi. look at ClangGCC

Now, GCC has a system of spec strings to specify how it works with & feeds other programs: http://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html

Your task would be to tune them to your needs; once done, please document it and/or make an EasyBuild toolchain that others can rely upon!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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