make-target-2.sh PIE failure on ppc64le and ppc64

Bug #1900258 reported by Thomas Fitzsimmons
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

When building on a Debian sid system with the following package
versions:

Linux 5.8.0-3-powerpc64le #1 SMP Debian 5.8.14-1 (2020-10-10) ppc64le GNU/Linux
GNU assembler (GNU Binutils for Debian) 2.35.1
cc (Debian 9.3.0-18) 9.3.0
ldd (Debian GLIBC 2.30-8) 2.30

$ sh make.sh

results in:

 [...]
//entering make-target-2.sh
//doing warm init - compilation phase
./src/runtime/sbcl: error while loading shared libraries: R_PPC64_ADDR16_HI reloc at 0x0000000105532f68 for symbol `' out of range

real 0m0.003s
user 0m0.001s
sys 0m0.002s
$ echo $?
127
$

Likewise on a Debian 10 ppc64 system with the following package versions:

Linux 5.2.0-2-powerpc64 #1 SMP Debian 5.2.9-2 (2019-08-21) ppc64 GNU/Linux
GNU assembler (GNU Binutils for Debian) 2.35.1
cc (Debian 10.2.0-13) 10.2.0
ldd (Debian GLIBC 2.31-4) 2.31

$ sh make.sh --arch=ppc64

results in:

[...]

//entering make-target-2.sh
//doing warm init - compilation phase
./src/runtime/sbcl: error while loading shared libraries: R_PPC64_ADDR16_HI reloc at 0x000000013fbc6e02 for symbol `' out of range
$ echo $?
127
$

These failures started showing up due to:

   commit 78de8730813a8a2d0c7f5c125fff3cfaa129f63b
   Author: Douglas Katzman <email address hidden>
   Date: Mon Sep 21 22:05:19 2020 -0400

       Remove DISABLE_PIE

       Use the toolchain default everywhere, whether it makes a PIE or not.

which resulted in sbcl being built as a position-independent
executable by default.

The attached patches fix the build in both cases; do they look OK?

They change the linkage table entry size on ppc64 to accommodate
call_into_c loading the two high address bytes. There may be a better
approach that keeps the entry size to 24 bytes; if that matters, I can
attempt another version of the patch.

The patches also do not attempt to handle the PIE-disabled case, where
the extra instructions aren't needed, the same as before. I'm not
sure how much that matters since PIE seems to be encouraged and
default now.

Tags: review
Revision history for this message
Thomas Fitzsimmons (fitzsim) wrote :
Revision history for this message
Thomas Fitzsimmons (fitzsim) wrote :
tags: added: review
Revision history for this message
Stas Boukarev (stassats) wrote :

Doesn't it have some pseudo-instruction for loading constants?

Revision history for this message
Sébastien Villemot (sebastien-villemot) wrote :

I confirm that this bug affects the official Debian package, see the build log:
https://buildd.debian.org/status/fetch.php?pkg=sbcl&arch=ppc64el&ver=2%3A2.0.9-1&stamp=1602961283&raw=0

Revision history for this message
Thomas Fitzsimmons (fitzsim) wrote :

I looked around and I can't find a pseudo-instruction or mnemonic to use for the "Calculate LRA" section. This page says to just wrap the five instructions in a macro:

https://developer.ibm.com/technologies/linux/articles/l-ppc/

but the sequence only occurs once in ppc64-assem.S so I think it might as well be inlined.

Revision history for this message
Stas Boukarev (stassats) wrote :

Couldn't find it either and a macro wouldn't be able to avoid unnecessary instructions (easily). Oh well.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.