Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22032

powerpc-elf abi instead of elfv2 on 64 bit powerpc systems, is it possible?

$
0
0

I have been trying to cross compile gcc for 64-bit powerpc architecture. However, GCC configuration lacks "powerpc64-elf" target. It has "powerpc64-linux", powerpc-rtems (which can produces 32/64 bit code).

Digging further, I have read the following document (which describes the ABI used by linux for powerpc64 arch):https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html

Specification introduces an additional segment called TOC. Also, this specification uses ELFv2 format to address these changes.

My first (and maybe unrelated questions is) is;

  • using TOC for access to global variables that beneficial? Instead of using single load instruction, we have to jump to TOC table instead and then use a load instruction.
  • does something prevent us from using single load on powerpc systems?At this point, I am fairly uncertain about the advantages of (or even the necessity of) ELFv2 on ELF.

My actual question is, when compiling GCC, if I were to just change ABI to default powerpc ABI,

  • will the code produced by this compiler, can still produce valid 64bit code?
  • I am guessing even if this works, I may not be able utilize some components of the hardware?

Thanks in advance.

Edit:

Clarification:I forgot to mention that I am not planning to run the programs compiled using modified gcc on existing linux targets. Rather, I want to simplify ABI for OS architecture support package (possibly using the same architecture support both platforms).

In this case, I want to run 64 bit code (without 4GB memory limit) using ELFv1 ABI on powerpc64 architecture using powerpc-linux (rather than powerpc64-linux).

TOC/GOT overheads:According to Bill's answer about GOT and TOC overheads, I compared the dumps of simple programs compiled powerpc32 and powerpc64 compilers. As he described GOT too uses extra level of indirection. TOC seems to intruduce 2 additional instructions (a load immediate followed by an add immediate - which are trivial).

Edit2: In the end, I opted to use standard ABI. Compiler and OS needs a handshake at this point.

But I did create a custom configuration of gcc by observing other OS (like linux, rtems) and following this tutorial: Structure of a gcc backend.


Viewing all articles
Browse latest Browse all 22032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>