This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
ARM Linux PIC implementation
- To: egcs at cygnus dot com
- Subject: ARM Linux PIC implementation
- From: Russell King <rmk at ecs dot soton dot ac dot uk>
- Date: Tue, 2 Dec 1997 23:00:43 +0000 (GMT)
- Reply-To: rmk at ecs dot soton dot ac dot uk
Hi!
I'm working on GCC 2.7.2.2 trying to get an ARM PIC implementation going for
ARM/ELF. I've managed to get some areas working, but unfortunately not others...
Currently, I have the following two problems:
1. I need GCC to be able to output into the per-function constant pool
an expression such as:
.word _GLOBAL_OFFSET_TABLE_ - L2 - 8
This is not supported by the gcc 2.7.2.2 decode_rtx_const in varasm.c
The RTX code that I'll be looking to call force_const_mem with is
along the following lines:
(const (minus (minus (symbol ref "_GLOBAL_OFFSET_TABLE_)
(code label "L2"))
(const_int 8))
2. For certain data types, I can't modify the GCC RTL to add in the PIC
GOT register, eg
extern int wibble;
static char err_1[16][16] = { "Hello", "World" };
static char *err_2[16] = {"Hello", "World" };
char *p1, *p2;
int foo (int c)
{
wibble = c + c << 1;
p1 = err_1[c];
p2 = err_2[c];
}
The RTL looks good, except for the `p2 = err_2[c]' expression,
and at no point do I see any call to the `movsi' op to indicate this -
the only reference I see is a reference to LC4, the constant pool label
which contains the `err_2' base address.
The RTL generated by GCC is exactly the same as if it was not generating
PIC therefore. Is there somewhere else that I should be looking to add
PIC functions?
I have added code for LEGITIMIZE_ADDRESS, LEGITIMATE_PIC_OPERAND_P,
FINALIZE_PIC, and added a new function to output a PIC address constant
(similar to output_addr_const.
Any suggestions that you have will be appreciated. BTW, I'm not subscribed
to this mailing list, so if you could reply this mail please.
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King rmk@ecs.soton.ac.uk --- ---
| | | | http://www.arm.uk.linux.org/~rmk/home.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |