This page contains status information about efforts to bring LLVM to PowerPC64 target, using OpenPower ELF v2 ABI.

/!\ This code is under rapid development and testing; it is not yet ready for production use as of 20191111.

Build status summary

base

The summary bellow is valid when using in-base llvm 9.0.0 + patches. GNU LD v2.17 is currently needed for 32 bit sysroot/libraries):

Description

Build Status

Sanity Status

Info

base (minimal)

OK

OK

with patches

base (LIB32)

OK

OK

with patches. (see known issues bellow)

base (toolchain)

OK

OK

with patches.

stand/bootloader

OK

OK

with patches. Tested on power8/QEMU-pseries and G5

kernel

OK

OK

Tested on power8/QEMU-pseries and G5 and power9. Some power9 bare-metal requires an updated OPAL firmware (or disable OPAL Flash)

disc1.iso

OK

OK

ports

from the ISO

The ports summary bellow is based on FreeBSD 13 installed from the ELFv2 experimental ISO.

Ports Package

Build Status

Sanity Status

Info

lang/gcc8

OK*

OK

need to be patched for ELFv2 239813#c6 fixed in r509607

lang/gcc9

OK*

OK

fixed in r509718

lang/rust

OK*

OK

*Patch to be submitted by Mikael Urankar D20792

lang/ghc

OK

OK

GCC8 is currently required due to 42541

ports/java/openjdk8

OK*

OK

*Patch to be submitted by Mikael Urankar

lang/fpc

DISABLED

Package configured only for amd64 386 currently. Also would require ELFv2 compatible bootstrap

www/node

OK*

OK*

with patch D21588. Doesn't run on G5 due to use of newer instructions like "friz". But needs to be merged with linimon patch for elfv1.

databases/mariadb55-client

OK*

OK*

build crashes using LLVM8. Need to patch Makefile to force use of LLVM9. MarkLinimon to test.

/!\ for lang/gcc[89], you will most likely also need the changes leading up to r509282. Recommended: update to the ports tree as of at least 20190829.

Test environment: QEMU 4.0 rc0 virtual machine pseries with KVM acceleration, running on host machine with CPU POWER8E model 2.1.

(-machine pseries-4.0,accel=kvm,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-hpt-max-page-size=16M)

from ppcdevref

There is a more detailed ports summary native-built on an IBM Power8 machine (ppcdevref) on loan to us by OSU.


Patches

FreeBSD Base

Description

URL

Status

makes LLVM default on PowerPC64

D20378

review (flag day)

LLVM - change default ABI for FreeBSD13.0+

D20383

review (flag day)

fix LIB32 build (Makefile.libcompat)

D20261

review

fix incorrect clang target triple computation (Makefile.inc1)

D19237

review

Fix broken kernel modules due to LLD 9+ TOC optimization

D22317

review

fix emulation name passed to linker when cross compiling

D21800

review

[PowerPC] force applications linked with lib CSU to have .got

43148 D21476

committed r353455

powerpc: Transition to Secure-PLT, like most other OSs (Toolchain part)

rS349351

commited

add ifunc support in libcsu

D21070

committed

don't mark ld.bfd as obsolete

D21136

committed

fix ifunc indirect call crash

D21102

committed

LLVM - backport FreeBSD/PowerPC64 LLVM9 upstream changes

D20337

abandoned (after 8.0.1 was merged)

fix missing powerpc64 in _LLVM_TARGET_FILT

D20756

committed

readelf: print description for 'e_flags' in ELF header (ABI type)

D20782

committed

add ABI flags to 'file' magic

D20771

committed

fix panic when loading if_epair.ko built with modern compiler

D20461

committed r349377

fix kernel build with lld8

D19352

committed (r348112)

fix stand/bootloader build

D20026

committed

ship ld.bfd with base

D20259

committed

fix wrong KASSERT in mphyp_pte_insert()

D20012

committed

fix pseries-llan (QEMU)

D20008

committed

silence cast-align warnings from clang on powerpc64

D18807

committed

fix rtld-elf compilation warning for powerpc64 ELFv2 ABI

D18808

committed

fix compilation error (contrib/binutils/opcodes/ppc-dis.c)

D19235

committed r344791

fix compilation error (include/pthread.h)

D19236

abandoned after test with r344922

increase ctfconvert buffer size

D19353

committed

fix kldxref

D19370

committed

FreeBSD Ports

/!\ Packages are not yet being built for this configuration; for now, you will have to build your own. Expect to find failures as unlike the results with gcc, few ports have really been tested.

/!\ Use of the -CURRENT powerpc packages built on FreeBSD.org may or may not work (it has not been tested as of 20190705).

Description

URL

Status

Mk/bsd.port.mk: detect powerpc64 abi

D22039

review

llvm-devel on powerpc64: add configure option to select ELFv2 ABI

D22100

committed r515154

backport of LLVM 9 fixes in preparation for building FreeBSD/PowerPC64

D20375

abandoned - ports/llvm80 is at 8.0.1, which contains all important changes

LLVM 9.0

Description

URL

Status

9.x backport

change default ABI for FreeBSD13.0+

to be released

Fix openmp on PowerPC64-BE-ELFv2 ABI on FreeBSD

D67190

under review (also see below)

merged into FreeBSD base-LLVM9 (r352763)

[PowerPC] Do not emit HW loop if the body contains calls to lrint/lround

43527

Fixed in LLVM 10

Requested [https://bugs.llvm.org/show_bug.cgi?id=43967|43967]

[PPC32] Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO

43150 D66925

Fixed in LLVM 10

43178 9.0.0 (r371059)

powerpc 32 bit binary segfault due to secure-plt vs bss-plt conflict

43116

Fixed in LLVM 9.0.0

43148 9.0.0 (r370312, r370313)

LLVM 8.0.0

/!\ This list of patch is for reference only. Efforts are now being focused on LLVM9

Description

URL

Status

8.x backport

change default ABI for FreeBSD13.0+

to be released

[PPC32] Fix PLT calls for -msecure-plt -fpic

D63563

commited in LLVM9/head

[PowerPC64] lld incorrectly optimizes ifunc TOC relocations

42759

fixed in LLVM10/head

Issue doesn't occur on 8.x

Adds ABI parsing when specified on target triple

D61950

commited in LLVM9/head

41981 unfeasible for 8.0.1

[libunwind] Fix r2 not properly restored

41050, D59694

commited in LLVM9/head

41942 8.0.1 (r360861 r364217)

Consider localentry offset when computing branch distance

D61058

commited in LLVM9/head

42332 8.0.1 (r359094 r364209)

[PPC] Fix 32-bit build of libunwind

D61792

commited in LLVM9/head

41941 8.0.1 (r360862 r363030)

llvm-objdump: when ELF st_other field is set, print its value before symbol name

D61647 D61718

commited in LLVM9/head

41961 8.0.1 (r360439 r362668)

Implement Thunk Section Spacing

D61610 D61720

commited in LLVM9/head

41959 8.0.1 (r353865 r353866 358975 r360405 r362043 r362273 r362274)

Update LocalEntry from assigned symbols

D56586

commited in LLVM9/head

41960 8.0.1 (r361237 r362671)

Preserve LocalEntry when linking

D56782

commited in LLVM9/head

41943 8.0.1 (r354184 r361921)

Fix missing ELF st_other field on versioned symbols

41048, D59436

commited in LLVM9/head

41968 8.0.1 (r360439 r360442 r362668 r362669)


Pending Issues

List of currently known pending issues. This list assumes above patches are already applied.

FreeBSD base

Description

URL

Workaround

Status

LIB32 C++ exception is broken when linked with LLVM LLD 9

43350

Use GNU LD v2.17; with clang9, use -fPIC or -fpic

needs investigation

LIB32 binaries are broken when linked with LLVM LLD 9

43116

43148

fixed

LIB32 binaries are broken when linked with LLVM LLD 8

Use GNU LD v2.17

abandoned since support was improved in LLVM9 and FreeBSD 13 will upgrade to LLVM9

slof loader is broken when linked with LLVM LLD 8

Fixed in LLVM LLD

LLD PowerPC 32-bit support is being improved. See 40888

LIB32 build is incompatible with WITH_LLVM_LIBUNWIND=yes

Fixed

See D61792

FreeBSD base compiler

Description

URL

Workaround

Status

Integrated AS doesn't implement mulldo, addo and subfo instructions

42541

use GNU AS 2.30+

Patch available but not tested (under review) D66902

Invalid PPC CTR loop when building node (clang900-import branch)

43527

merged in FreeBSD base (r353358)

enable OpenMP on powerpc64

D21532

fix commited r352763 (clang900-import)

LLVM/lld large binaries (like clang itself) may get a wrong/corrupted .init after link

40740

21690

D61610D61720 Fix available

LLVM/lld doesn't implement dynamic relocations R_PPC_LOCAL24PC and R_PPC_GOT16 used by LIB32

40888

link with GNU LD 2.17

LLD PowerPC 32-bit support is being improved. See 40888

FreeBSD kernel

Description

URL

Workaround

Status

driver virtio drivers are not working.

D19815

needs investigation for a proper fix. (It is NOT a ELFv2 related issue, it's seen on ELFv1 too)

'kldload if_epair' causes kernel panic

232387 D20461

fixed r349377

[ppc][pseries] panic: Error evicting page: -7

237470

Fixed

FreeBSD ports

Description

URL

Workaround

Status

cannot build rust package (firefox dependency)

D20792

see D20792

rust-elfv2 bootstrap is a work in progress

Petitiboot - kexec (bare metal)

Description

URL

Workaround

Status

kexec can't boot ELFv2 FreeBSD kernel

https://github.com/antonblanchard/kexec-lite/pull/9

On petitboot console, download and use http://drop.rtk0.net/kexec instead

committed, is in Talos II/Lite/Blackbird PNOR beta firmware. Only affects platforms using kexec-lite containing this commit. Older versions of kexec-lite did not do the erroneous computation and always used the first address of .text as the entry point. There're reports of IBM Power9 and some IBM Power8 machines are affected.

Contact

FreeBSD IRC Channels

powerpc/llvm-elfv2 (last edited 2019-11-11 18:32:06 by AlfredoDalAva)