From a5bb56599c44d46fa6aba94baff2bd2058c41523 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 10 May 2023 16:52:24 -0700 Subject: [PATCH] Fix PIC for PowerPC. Must put `got2` into the flash region. --- arch.mk | 3 +-- hal/nxp_p1021_stage1.ld | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch.mk b/arch.mk index 1586af82..0cf72cb3 100644 --- a/arch.mk +++ b/arch.mk @@ -316,9 +316,8 @@ endif ifeq ($(TARGET),nxp_p1021) # Power PC big endian - ARCH_FLAGS=-m32 -mhard-float -mcpu=e500mc -mno-powerpc64 + ARCH_FLAGS=-m32 -mhard-float -mcpu=e500mc ARCH_FLAGS+=-fno-builtin -ffreestanding -nostartfiles - ARCH_FLAGS+=-mno-pointers-to-nested-functions CFLAGS+=$(ARCH_FLAGS) -DBIG_ENDIAN_ORDER CFLAGS+=-DWOLFBOOT_DUALBOOT CFLAGS+=-pipe # use pipes instead of temp files diff --git a/hal/nxp_p1021_stage1.ld b/hal/nxp_p1021_stage1.ld index fefdcd49..2c2f4754 100644 --- a/hal/nxp_p1021_stage1.ld +++ b/hal/nxp_p1021_stage1.ld @@ -36,6 +36,9 @@ SECTIONS *(.text*) *(.rodata*) *(.sdata*) + + /* For PIC the linker script variables come from here */ + *(.got2) } > FLASH . = ALIGN(4); @@ -61,10 +64,6 @@ SECTIONS .data : AT (_stored_data) { _start_data = .; - KEEP(*(.iplt*)) - KEEP(*(.plt*)) - KEEP(*(.got1*)) - KEEP(*(.got2*)) KEEP(*(.data*)) . = ALIGN(4); KEEP(*(.ramcode))