This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14745] New: -msdata=eabi does not produce r2/r13 relative access
- From: "kate at iti dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Mar 2004 15:09:39 -0000
- Subject: [Bug c/14745] New: -msdata=eabi does not produce r2/r13 relative access
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I try compile program with following options :powerpc-8xx-eabi-gcc -fverbose-asm
-O2 -I../include -meabi -memb -msdata=eabi -Wa,-al -G10000 hello.c -o hello.o
The test program is simple one (end of this mail )
The manual clearly states:
-msdata=eabi
On System V.4 and embedded PowerPC systems, put small initialized const
global and static data in the .sdata2 section, which is pointed to by register
r2. Put small initialized non-const global and static data in the .sdata
section, which is pointed to by register r13.
So, the all data unnder 10000 bytes hould put in small data sections
and addressed with register relative instructions but this does not
happen. I even checked from produced assembly listing that it
uses la instruction ( addi %r,0,<immediate>) instead using
addi %r,%r2,<immediate> that forms address relative to r2 ( or r13 )
Also storing the valu e i is
52 0028 90000000 stw 0,i@sda21(0) # i
instead sww 0,i(2)
Also, i can't pass it to linker because it gives
relocation truncated to fit: R_PPC_EMB_SDA21 hellos
Ithis my be my fault mut least i have not found solution
anywhere how to make register relative ( position independent)
data to wark. The my main goal is just compile position independent
code and data for my open source Katix rtos. I ahave also tried many
gcc versions starting from 2.x.x and got no-one working.
Kate
const char hellos[] = "hello: Hello, world!\n\r";
volatile int i;
int _start() {
for(;;) {
i=my_strlen(hellos);
i=my_strlen("hello: Hello, world!\n\r");
}
}
int my_strlen(char *s)
{
int i=0;
while(*s++) i++;
return i;
}
--
Summary: -msdata=eabi does not produce r2/r13 relative access
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kate at iti dot fi
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: powerpc-8xx-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14745