From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Salter To: Andy.Simpkins@Transcomm.uk.com Cc: jlarmour@redhat.com, Andy.Simpkins@Transcomm.uk.com, ecos-discuss@sources.redhat.com Subject: Re: [ECOS] forwarded message from Simpkins, Andy Date: Fri, 17 Aug 2001 10:13:00 -0000 Message-id: <200108171713.f7HHDFo02475@deneb.localdomain> References: <919A3A7F776FD311AFD600508B44A7F30179584C@ramhqlon.transcomm.uk.com> X-SW-Source: 2001-08/msg00623.html >>>>> 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