]> granicus.if.org Git - clang/commit
[PowerPC] Support ELFv1/ELFv2 ABI selection via -mabi= option
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 28 Jul 2014 13:17:52 +0000 (13:17 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Mon, 28 Jul 2014 13:17:52 +0000 (13:17 +0000)
commitaccdaf18cb2b42cd8d45bc019e32a17aa5523be4
tree3a5c394638b6b6b35050c843eda4c7a22d215ea4
parentad9a8589658719a4f8856eadeb86518891b33143
[PowerPC] Support ELFv1/ELFv2 ABI selection via -mabi= option

While Clang now supports both ELFv1 and ELFv2 ABIs, their use is currently
hard-coded via the target triple: powerpc64-linux is always ELFv1, while
powerpc64le-linux is always ELFv2.

These are of course the most common scenarios, but in principle it is
possible to support the ELFv2 ABI on big-endian or the ELFv1 ABI on
little-endian systems (and GCC does support that), and there are some
special use cases for that (e.g. certain Linux kernel versions could
only be built using ELFv1 on LE).

This patch implements the Clang side of supporting this, based on the
LLVM commit 214072.  The command line options -mabi=elfv1 or -mabi=elfv2
select the desired ABI if present.  (If not, Clang uses the same default
rules as now.)

Specifically, the patch implements the following changes based on the
presence of the -mabi= option:

In the driver:
- Pass the appropiate -target-abi flag to the back-end
- Select the correct dynamic loader version (/lib64/ld64.so.[12])

In the preprocessor:
- Define _CALL_ELF to the appropriate value (1 or 2)

In the compiler back-end:
- Select the correct ABI in TargetInfo.cpp
- Select the desired ABI for LLVM via feature (elfv1/elfv2)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214074 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Basic/Targets.cpp
lib/CodeGen/TargetInfo.cpp
lib/Driver/Tools.cpp
lib/Driver/Tools.h
test/CodeGen/ppc64-elf-abi.c [new file with mode: 0644]
test/Driver/linux-ld.c
test/Driver/ppc-abi.c [new file with mode: 0644]
test/Preprocessor/init.c