From b8553eed107503dbf0ae3f0fe1f6002ffafb4e3a Mon Sep 17 00:00:00 2001 From: jhibbits Date: Mon, 5 Aug 2019 01:37:18 +0000 Subject: [PATCH] powerpc: Get 32-bit AIM building with secure-PLT The last few changes needed before 32-bit AIM builds with secure-PLT with base GCC. Because ofwcall32.S and swtch32.S were branching to the GOT it could not use secure PLT. --- sys/powerpc/ofw/ofwcall32.S | 15 ++++++++++++--- sys/powerpc/powerpc/swtch32.S | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/powerpc/ofw/ofwcall32.S b/sys/powerpc/ofw/ofwcall32.S index 6c460c115578..dd657518dc3c 100644 --- a/sys/powerpc/ofw/ofwcall32.S +++ b/sys/powerpc/ofw/ofwcall32.S @@ -67,8 +67,11 @@ ASENTRY(ofwcall) mfmsr %r6 /* GOT pointer in r7 */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r7 + addis %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@l /* read client interface handler */ lwz %r4,openfirmware_entry@got(%r7) @@ -129,8 +132,11 @@ ASENTRY(rtascall) stw %r0,4(%r1) /* GOT pointer in r7 */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r7 + addis %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@l /* Record the old MSR to real-mode-accessible area */ mfmsr %r0 @@ -152,8 +158,11 @@ ASENTRY(rtascall) bctrl /* GOT pointer in r7 */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r7 + addis %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r7,%r7,(_GLOBAL_OFFSET_TABLE_-1b)@l /* Now set the MSR back */ lwz %r6,rtas_regsave@got(%r7) diff --git a/sys/powerpc/powerpc/swtch32.S b/sys/powerpc/powerpc/swtch32.S index 1bcb08a27132..5dd189df0570 100644 --- a/sys/powerpc/powerpc/swtch32.S +++ b/sys/powerpc/powerpc/swtch32.S @@ -124,8 +124,11 @@ ENTRY(cpu_switch) cpu_switchin: #if defined(SMP) && defined(SCHED_ULE) /* Wait for the new thread to become unblocked */ - bl _GLOBAL_OFFSET_TABLE_@local-4 + bl 1f +1: mflr %r6 + addis %r6,%r6,(_GLOBAL_OFFSET_TABLE_-1b)@ha + addi %r6,%r6,(_GLOBAL_OFFSET_TABLE_-1b)@l lwz %r6,blocked_lock@got(%r6) blocked_loop: lwz %r7,TD_LOCK(%r2)