This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linux/PPC 32 bit problem with .data > 64M?


mendell@ca.ibm.com writes:

> If you compile the following with gcc
> 
> char realbig[36000032] = {1,2};
> int main()
> {
>         printf ("&realbig = %#lx\n", &realbig);
> }
> You get:
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x20): relocation truncated to fit: R_PPC_REL24
> __libc_start_main@@GLIBC_2.0
> /usr/lib/crti.o: In function `call_gmon_start':
> /usr/lib/crti.o(.text+0x14): relocation truncated to fit: R_PPC_LOCAL24PC
> _GLOBAL_OFFSET_TABLE_
> /usr/lib/gcc-lib/powerpc-suse-linux/2.95.3/crtbegin.o: In function
> `__do_global_dtors_aux':
> /usr/lib/gcc-lib/powerpc-suse-linux/2.95.3/crtbegin.o(.text+0x88):
> relocation truncated to fit: R_PPC_PLTREL24
> __deregister_frame_info@@GLIBC_2.0
> /usr/lib/gcc-lib/powerpc-suse-linux/2.95.3/crtbegin.o: In function
> `frame_dummy':
> /usr/lib/gcc-lib/powerpc-suse-linux/2.95.3/crtbegin.o(.text+0x108):
> relocation truncated to fit: R_PPC_PLTREL24
> __register_frame_info@@GLIBC_2.0
> 
> %  ld -v
> GNU ld version 2.11.90.0.29 (with BFD 2.11.90.0.29)
> 
> The problem is that .plt is placed after .data, and the really big .data (>
> 2**26) prevents the relocations from fitting.  Is there any fix for this?
> I understand from looking at the linker script, that the .plt section wants
> to go with the bss section, and it is put near the .got section.  Is there
> any way to take advantage of the latter?  Anything else I can do?  I tried
> moving the .plt section in elf32ppclinux.x to after .rodata1, but got:
> /usr/lib/crti.o: In function `call_gmon_start':
> /usr/lib/crti.o(.text+0x14): relocation truncated to fit: R_PPC_LOCAL24PC
> _GLOBAL_OFFSET_TABLE_
> 
> which makes sense, since the GOTis now too far from the .text section.
> 
> Does ELF really only support 64M of .data on Linux/PPC?

Yes, but you have to arrange things so that .data is placed after .plt
and .got.  This is not done by default because very few (approximately
zero) objects are this large and there is an efficiency penalty; you
have to either include .plt in the object file, wasting space there,
or have to have multiple PHDR entries which slows down loading.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]