This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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: Trying to build newlib without GOT


The following is an excerpt from newlib/configure.host:

  powerpc*-*-eabi* | \
  powerpc*-*-elf* | \
  powerpc*-*-linux* | \
  powerpc*-*-rtem* | \
  powerpc*-*-sysv* | \
  powerpc*-*-solaris*)
        newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES -DWANT_PRINTF_LONG_LONG"
        ;;

Note the -mrelocatable-lib option. From info gcc:

`-mrelocatable-lib'
`-mno-relocatable-lib'
     On embedded PowerPC systems generate code that allows (does not
     allow) the program to be relocated to a different address at
     runtime.  Modules compiled with `-mrelocatable-lib' can be linked
     with either modules compiled without `-mrelocatable' and
     `-mrelocatable-lib' or with modules compiled with the
     `-mrelocatable' options.

-- Jeff J.

Erik Christiansen wrote:
   Is there something in the newlib distribution which causes the build
   to create position independent code, but in a non-obvious way?

Having successfully built newlib for an MPC850, using:

../newlib-1.9.0/configure -host=ppc-elf --target=powerpc-linux \
         -prefix=/usr/local/src/newlib_ppc_elf_1.9.0/output/

   we find that the generated code used Global Offset Tables. i.e.
   position independent code is being generated. But there is no -fpic
   or -fPIC in any of the makefiles:

   PICFLAG =
   PICFLAG_FOR_TARGET =

   If PIC is not obviously turned on, I'm wondering how we might turn it
   off??

the only non-comment line in config.cache is:

ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}

so it's a bit awkward to diagnose what the newlib config has done.

   Would building a powerpc-elf-gcc, instead of using powerpc-linux-gcc,
   be the answer? It's just a WAG, but I'll try it next.

Regards,
Erik





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