This is the mail archive of the
mailing list for the binutils project.
Re: My problem with the LD linker
- From: Nick Clifton <nickc at redhat dot com>
- To: Marian Kechlibar <marian dot kechlibar at circletech dot net>, binutils at sourceware dot org
- Date: Wed, 22 Feb 2017 12:07:59 +0000
- Subject: Re: My problem with the LD linker
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
> I can compile and link them either using:
> * ARMCC/ARMLINK 2.2
> * GCC(E) 4.6.3 and Binutils 2.21 or 2.27.
> The second option (GCC/Binutils) works for the first four projects, but
> the link phase (using ld) fails for the fifth project, saying:
> unresolvable R_ARM_THM_CALL relocation against symbol
> I have a suspicion that the problem is in *size* of the resulting
> binary. The "Expert" project is rather big, several times bigger
> than the "Cleaner" project. But I do not understand ELF well enough
> to remedy the problem.
> Is it possible that some section of the resulting ELF file overflows?
Yes. It may well be that the executable is so big that the distance from where
the Invariant function is being called and where it is being defined will not
fit into the Thumb function call instruction.
Several ideas come to mind:
* Compile for ARM rather than THUMB - the ARM supports a larger address space.
* Compile with GCC but link with ARMLINK. (You did say that using ARMCC/ARMLINK works).
* Compile with -ffunction-sections and -fdata-sections enabled and then link with -gc-sections enabled.
This might help to reduce the code size by eliminating unused code/data.
* Change the order of the object files on the linker command line so that uc_exe.o
object is located closer to the system library that defines it.
* Compile with -mlong-calls enabled so that function calls to far away destinations should work.