How to support 64-bit PowerPC -mcmodel=medium?

Sebastian Huber
Tue Aug 22 22:44:00 GMT 2017

On 12/08/17 01:15, Segher Boessenkool wrote:

> On Fri, Aug 11, 2017 at 11:33:08AM +0200, Sebastian Huber wrote:
>> crtstuff.s: Assembler messages:
>> crtstuff.s:44: Error: can't resolve `.tm_clone_table' {.tm_clone_table
>> section} - `.LCTOC1' {.toc1 section}
>> crtstuff.s:45: Error: can't resolve `__TMC_END__' {*UND* section} -
>> `.LCTOC1' {.toc1 section}
> Maybe you want to
> for your subtarget?
> I don't see what is the real problem causing your issues, but that
> should allow you to get further at least.

I had to do this:

The main issue was that I didn't define RS6000_ABI_NAME, so 
SUBTARGET_OVERRIDE_OPTIONS() from sysv4.h selected ABI_V4. This triggered:

   if (flag_pic > 1 && DEFAULT_ABI == ABI_V4)      \
     {                                    \
       /* Note: flag_pic should not change any option flags that would    \
      be invalid with or pessimise -fno-PIC code.  LTO turns off    \
      flag_pic when linking/recompiling a fixed position executable. \
      However, if the objects were originally compiled with -fPIC,  \
      then other target options forced on here by -fPIC are restored \
      when recompiling those objects without -fPIC.  In particular  \
      TARGET_RELOCATABLE must not be enabled here by flag_pic.  */  \
       rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC;            \
       TARGET_NO_FP_IN_TOC = 1;                        \

The minimal TOC option apparently didn't work well for the crtbeginS.o.

With this patch I am now able to build RTEMS with the FreeBSD network 
stack utilizing > 4GiB of RAM on a T4240. Segher, thanks for your kind 
help. Without your help I would still struggle with the GCC configuration.

Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  :
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the Gcc mailing list