This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: forwarded message from Simpkins, Andy
- To: Andy dot Simpkins at Transcomm dot uk dot com
- Subject: Re: [ECOS] forwarded message from Simpkins, Andy
- From: Mark Salter <msalter at redhat dot com>
- Date: Fri, 17 Aug 2001 13:13:15 -0400
- CC: jlarmour at redhat dot com, Andy dot Simpkins at Transcomm dot uk dot com, ecos-discuss at sources dot redhat dot com
- References: <919A3A7F776FD311AFD600508B44A7F30179584C@ramhqlon.transcomm.uk.com>
>>>>> Simpkins, Andy writes:
> main.o: In function `main':
> main.o(.text+0x10): relocation truncated to fit: R_ARM_PC24
> flash_query(void)
> collect2: ld returned 1 exit status
> what is ld trying to tell me with the truncated error message? I note that
> this is in the function main NOT flash_query, is this significant?
The linker is being asked to patch an opcode with the difference between
the PC and an address. The R_ARM_PC24 indicates the opcode needs a 24-bit
pc-relative offset. The long_call attribute should force gcc/gas to ask
for a 32-bit absolute address instead of pc-relative.
Here's what the gcc manual says:
`-mlong-calls'
`-mno-long-calls'
Tells the compiler to perform function calls by first loading the
address of the function into a register and then performing a
subroutine call on this register. This switch is needed if the
target function will lie outside of the 64 megabyte addressing
range of the offset based version of subroutine call instruction.
Even if this switch is enabled, not all function calls will be
turned into long calls. The heuristic is that static functions,
functions which have the `short-call' attribute, functions that
are inside the scope of a `#pragma no_long_calls' directive and
functions whose definitions have already been compiled within the
current compilation unit, will not be turned into long calls. The
exception to this rule is that weak function definitions,
functions with the `long-call' attribute or the `section'
attribute, and functions that are within the scope of a `#pragma
long_calls' directive, will always be turned into long calls.
--Mark