This is the mail archive of the binutils@sourceware.cygnus.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]

Re: 2.9.1 gas, PowerPC, and PIC


>>>>> "ILT" == Ian Lance Taylor <ian@zembu.com> writes:

  ILT>    Date: Wed, 30 Jun 1999 15:39:40 -0500 (CDT)
  ILT>    From: Thomas A Peterson <tap@htc.honeywell.com>

  ILT>    It looks like gas does not support PIC for the PowerPC. Can someone
  ILT>    clue me in on how big of an effort it would be to add PIC support to
  ILT>    gas for the PowerPC.

  ILT> Gas certainly does support PIC for PowerPC ELF.  What makes you say
  ILT> that it does not?

There is no reference to it from the gas NEWS file.

   From gas NEWS file with 2.9.1
   ...
   Added PIC support to Solaris and SPARC SunOS 4 assembler.
   ...
   Initial i386-svr4 PIC implementation from Eric Youngdale, based on code
   by Paul Kranenburg.
   ...

Also, the GCC info file seems to be lagging.

   From the GCC info file with 2.8.1

   * The GNU assembler (GAS) does not support PIC.  To generate PIC
     code, you must use some other assembler, such as `/bin/as'.

  ILT> Note that PowerPC code tends to be position independent by its very
  ILT> nature.  What it means for gas to support PIC for PowerPC ELF is that
  ILT> it supports the generation of various special relocation types.

Here is my example that's causing me grief.  I would expect a procedure
linkage table but there is none instead I'm getting relocations that would
require the code segment to be writable (DT_TEXTREL).  

Am I confused as to what it means for gas to support PIC?  Ultimately, I
need the code to execute from flash or ROM and not RAM.

bash.exe-2.02$ powerpc-elf-gcc -fPIC -I. -g -c -o cpuprims.o cpuprims.S
bash.exe-2.02$ ld -shared -melf32ppc -o libcpu.so cpuprims.o
bash.exe-2.02$ objdump --all-headers --dynamic-reloc libcpu.so

libcpu.so:     file format elf32-powerpc
libcpu.so
architecture: powerpc:common, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x0000045c

Program Header:
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**16
         filesz 0x000005bc memsz 0x000005bc flags r-x
    LOAD off    0x000005c0 vaddr 0x000405c0 paddr 0x000405c0 align 2**16
         filesz 0x00000060 memsz 0x00000060 flags rw-
 DYNAMIC off    0x000005c0 vaddr 0x000405c0 paddr 0x000405c0 align 2**2
         filesz 0x00000050 memsz 0x00000050 flags rw-

Dynamic Section:
  HASH        0x94
  STRTAB      0x2fc
  SYMTAB      0x14c
  STRSZ       0x148
  SYMENT      0x10
  RELA        0x444
  RELASZ      0x18
  RELAENT     0xc
  TEXTREL     0x0

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .hash         000000b8  00000094  00000094  00000094  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .dynsym       000001b0  0000014c  0000014c  0000014c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynstr       00000148  000002fc  000002fc  000002fc  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .rela.text    00000018  00000444  00000444  00000444  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .text         00000160  0000045c  0000045c  0000045c  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  5 .data         00000000  000405c0  000405c0  000005c0  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  6 .dynamic      00000050  000405c0  000405c0  000005c0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  7 .got          00000010  00040610  00040610  00000610  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  8 .sdata2       00000000  00040620  00040620  00000620  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .sdata        00000000  00040620  00040620  00000620  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 10 .sbss         00000000  00040620  00040620  00000620  2**0
                  ALLOC
 11 .bss          00000000  00040620  00040620  00000620  2**0
                  ALLOC
SYMBOL TABLE:
00000094 l    d  .hash	00000000 
0000014c l    d  .dynsym	00000000 
000002fc l    d  .dynstr	00000000 
00000444 l    d  .rela.text	00000000 
0000045c l    d  .text	00000000 
000405c0 l    d  .data	00000000 
000405c0 l    d  .dynamic	00000000 
00040610 l    d  .got	00000000 
00040620 l    d  .sdata2	00000000 
00040620 l    d  .sdata	00000000 
00040620 l    d  .sbss	00000000 
00040620 l    d  .bss	00000000 
00000000 l    d  *ABS*	00000000 
00000000 l    d  *ABS*	00000000 
00000000 l    d  *ABS*	00000000 
00000000 l    df *ABS*	00000000 cpuprims.S
00000000 l    df *ABS*	00000000 ppc_defs.h
00000000 l    df *ABS*	00000000 cpuprims.S
00000000 l    df *ABS*	00000000 cpuprims.S
0000046c l     O .text	00000000 .ecEnd
0000047c l     O .text	00000000 .exEnd
00000488 l     O .text	00000000 .enEnd
00001000 l     O *ABS*	00000000 addressDeltaLo
00000002 l     O *ABS*	00000000 startingAddressHi
0000057c l     O .text	00000000 invLoop
000405c0 g     O *ABS*	00000000 _DYNAMIC
000005bc g     O *ABS*	00000000 _etext
00000520 g     F .text	00000000 virtualMemoryRegister__3CPU
0000047c g     F .text	ffffffe0 enableInterrupts__3CPU
0000045c g     F .text	00000010 enterCritical__3CPU
00000000         *UND*	00000000 enEnd
0000058c g     F .text	00000000 invalidateAllBATs
00000578 g     F .text	00000000 invalidateAllTLBs
00048620 g     O .sdata	00000000 _SDA_BASE_
0000046c g     F .text	00000010 exitCritical__3CPUUl
0000053c g     F .text	00000000 disablePaging__3CPU
0000054c g     F .text	00000000 initialize__3CPUi
000005b4 g     F .text	00000000 trap__3CPU
00000498 g     F .text	00000000 virtualMemoryRegister__3CPUUl
00040620 g     O *ABS*	00000000 _edata
00040614 g     O *ABS*	00000000 _GLOBAL_OFFSET_TABLE_
00040620 g     O *ABS*	00000000 _end
0000052c g     F .text	00000000 enablePaging__Fv
00048620 g     O .sdata2	00000000 _SDA2_BASE_
00000488 g     F .text	00000000 disableInterrupts__3CPU


DYNAMIC RELOCATION RECORDS
OFFSET   TYPE              VALUE 
00000560 R_PPC_REL24       invalidateAllBATs
00000564 R_PPC_REL24       invalidateAllTLBs


bash.exe-2.02$ 

  ILT> Ian

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