powerpc: fix and enable shared libraries by default on linux
ClosedPublic

Authored by trofi on Dec 7 2014, 7:30 AM.

Details

Summary

And fix things all the way down to it. Namely:

  • remove 'r30' from free registers, it's an .LCTOC1 register for gcc. generated .plt stubs expect it to be initialised.
  • fix PicBase computation, which originally forgot to use 'tmp' reg in 'initializePicBase_ppc.fetchPC'
  • mark 'ForeighTarget's as implicitly using 'PicBase' register (see comment for details)
  • add 64-bit MO_Sub and test on alloclimit3/4 regtests
  • fix dynamic label offsets to match with .LCTOC1 offset

Signed-off-by: Sergei Trofimovich <siarheit@google.com>

Test Plan

validate passes equal amount of vanilla/dyn tests

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
trofi updated this revision to Diff 1886.Dec 7 2014, 7:30 AM
trofi retitled this revision from to powerpc: fix and enable shared libraries by default on linux.
trofi updated this object.
trofi edited the test plan for this revision. (Show Details)
trofi added reviewers: simonmar, erikd.
trofi updated the Trac tickets for this revision.
austin requested changes to this revision.Dec 9 2014, 7:09 PM
austin edited edge metadata.

LGTM but please change the comments I mentioned.

compiler/cmm/CLabel.hs
1173–1174

Turn this into a Note declaration: they have a pretty standard and uniform style throughout the compiler, so it's easier to grep and notice.

compiler/nativeGen/PPC/CodeGen.hs
960–974

I assume this is what the other bit was referring to, but .LTC0C1 appears several times so it's not clear which you mean. :)

This revision now requires changes to proceed.Dec 9 2014, 7:09 PM
erikd edited edge metadata.Dec 10 2014, 2:30 AM

I tried building with this patch applied on top of git revision 2b528e9c and I'm getting

undefined reference to `__sync_val_compare_and_swap_8'
trofi added a comment.Dec 10 2014, 2:45 AM

@erikd, yeah. ghc-prim is broken for a while on all 32-bit arches except x86.
As they don't usually support 64-bit atomics.

Right now i'm using local hack like this:
http://code.haskell.org/~slyfox/0002-LOCAL-HACK-TODO-fix-it-properly.patch.txt

GHC does not use any of those ops anyway.
I plan to write/upstream something saner this weekend for it as well.

erikd added a comment.Dec 10 2014, 2:51 AM
In D560#15871, @trofi wrote:

@erikd, yeah. ghc-prim is broken for a while on all 32-bit arches except x86.
Right now i'm using local hack like this:
http://code.haskell.org/~slyfox/0002-LOCAL-HACK-TODO-fix-it-properly.patch.txt

Oh, wow, that's nasty! I'll give it a try :-).

erikd added a comment.Dec 10 2014, 3:10 AM
In D560#15872, @erikd wrote:

Oh, wow, that's nasty! I'll give it a try :-).

With that nasty patch it compiled. If you fix the things @austin mentioned, I'll be happy with this (and assuming the ghc-prim isssue is completely orthogonal to this one).

trofi updated this revision to Diff 1924.Dec 10 2014, 4:55 PM
trofi edited edge metadata.

Adapted Note style for PIC Codegen notes in and placed then in PPC/CodeGen

erikd accepted this revision.Dec 11 2014, 1:19 AM
erikd edited edge metadata.

LGTM. The lint warnings really aren't worth fixing.

austin accepted this revision.Dec 13 2014, 8:08 PM
austin edited edge metadata.

Yes, LGTM. However, please *do* fix the lint errors; yes, it's tedious sometimes, but if we aren't strict about it, nobody will ever fix it. In this case it's just de-indenting some comments a few lines in.

That said, you can fix those when you push this; no need for another round of review.

This revision is now accepted and ready to land.Dec 13 2014, 8:08 PM
This revision was automatically updated to reflect the committed changes.