Bug 14743 - -msdata=eabi does not produce r2/r13 relative access
Summary: -msdata=eabi does not produce r2/r13 relative access
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3.3
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 14744 14745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-26 15:01 UTC by Kate Alhola
Modified: 2012-01-11 12:26 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: powerpc-8xx-eabi
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kate Alhola 2004-03-26 15:01:56 UTC
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;
}
Comment 1 Andrew Pinski 2004-03-26 15:17:54 UTC
*** Bug 14745 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Pinski 2004-03-26 15:17:54 UTC
*** Bug 14744 has been marked as a duplicate of this bug. ***
Comment 3 Andrew Pinski 2004-03-26 15:19:02 UTC
Did you try with -fPIC or -fpic as I think PPC eabi is non-pic by default?
Comment 4 Kate Alhola 2004-03-26 15:24:55 UTC
Subject: Re:  -msdata=eabi does not produce r2/r13 relative
 access

pinskia at gcc dot gnu dot org wrote:

>------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-26 15:19 -------
>Did you try with -fPIC or -fpic as I think PPC eabi is non-pic by default?
>
>  
>
Yes i did. The -fpic does not produce position independent data access, 
only position
independent code section. All data access including acces to cons data 
is still
position dependnet. For some reason compiler also says that -fpic and
-msdata=eabi are incompatible but i don't understand why.

Ty be truly position independent, allow loading to any address in non mmu
processor memory, both data and program should be position independent 
and so data should be also
register relative as descripted for -msdata=eabi.

Kate
Comment 5 Alan Modra 2004-11-27 11:46:04 UTC
I'm not so sure this is a valid complaint.  There are other thing we don't put
into .sdata2, for example function addresses (see pr16343).
Comment 6 Manuel López-Ibáñez 2008-02-01 13:10:20 UTC
Reported almost 4 years ago, never confirmed. Is this still valid?
Comment 7 Richard Biener 2012-01-11 12:26:36 UTC
.