This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> Hi, > > I have observed a gcc problem for an embedded mpc8xx target (powerpc-eabi): > > I have 2 memory banks, in which .text has to be linked into. These memory > banks are more than 16MB apart (0x40000000 and 0x00000000). A custom linker > script tells which source module goes into which bank. > > GCC generates a "bl" (Opcode 0x48000000) for procedure > calls. Unfortunately this PPC instruction allows only 24bit (signed) > relative offset, i.e. the branch destination must be within +-8MByte > distance from the caller. > This is not true... gcc is generating absolutely correct code in this case! The "bl" instruction uses the link register (LR) as a target address, and with link register the core can achieve every position within 4Gbytes of the PowerPC (32-bit implementation) address space... Please, take a look into "PowerPC Microprocessor Family: The Programming Environments for 32-Bit Microprocessor". It's free on the Motorola web site. > > For cross bank subroutine calls different banks the linker gives a > relocation error: > > relocation truncated to fit: R_PPC_REL24 foo > > The source of trouble seems, that gcc does generate an offset limited > relative jump instruction, where an absolute jump would be more adequate. > > I know, PPC does not have absolute jumps, but that may be mimiced by > a bctrl or a blrl, after LR or CTR has been loaded with the absolute > destination address. > > Is there a way to tell gcc how to generate those absolute call methods? > Handcrafted inline assembler seems messy to me because of parameter > handling. > > gcc-2.95.2 > GNU ld 2.10.1 > gcc command line parameters: > /opt/gnu/powerpc-eabi/bin/gcc -c -g -Wall -fno-inline -O3 -mcpu=860 \ > -msoft-float -o foo.o ../src/foo.c > > P.S. > > Of course, there is the (obvious) solution for my immediate problem to > remap one memory bank into the 24bit scope of the other. > > However, the problem still remains if the .text segment would grow beyond > 8 MB. > > gm > -- > Gunter Magin magin[AT]skil.camelot.de > Joćo Cadamuro Junior LIT / CPDTT / CEFET-PR ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |