Author: jhibbits
Date: Sat Sep 28 03:33:07 2019
New Revision: 352832
URL: https://svnweb.freebsd.org/changeset/base/352832

Log:
  powerpc/booke64: Align initial stack setting to match that of aim64's
  
  Clang9/LLD9 appears to get quite confused with the instruction stream used
  to obtain the tmpstack pointer, almost as though it thinks this is a C
  function, so tries to optimize it.  Since the AIM64 method doesn't use the
  TOC to obtain the tmpstack, just follow that model, and lld won't get
  confused.
  
  Reported by:  bdragon
  MFC after:    2 weeks

Modified:
  head/sys/powerpc/booke/locore.S

Modified: head/sys/powerpc/booke/locore.S
==============================================================================
--- head/sys/powerpc/booke/locore.S     Sat Sep 28 02:49:46 2019        
(r352831)
+++ head/sys/powerpc/booke/locore.S     Sat Sep 28 03:33:07 2019        
(r352832)
@@ -298,16 +298,18 @@ done_mapping:
        ld      %r1,0(%r2)
        add     %r2,%r1,%r2
        mtspr   SPR_SPRG8, %r2
+       nop
 
        /* Get load offset */
        ld      %r31,-0x8000(%r2) /* First TOC entry is TOC base */
        subf    %r31,%r31,%r2   /* Subtract from real TOC base to get base */
 
        /* Set up the stack pointer */
-       addis   %r1,%r2,TOC_REF(tmpstack)@ha
-       ld      %r1,TOC_REF(tmpstack)@l(%r1)
-       addi    %r1,%r1,TMPSTACKSZ-96
-       add     %r1,%r1,%r31
+       bl      1f
+       .llong  tmpstack + TMPSTACKSZ - 96 - .
+1:     mflr    %r3
+       ld      %r1,0(%r3)
+       add     %r1,%r1,%r3
        bl      1f
        .llong _DYNAMIC-.
 1:     mflr    %r3
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to