Skip to content

Commit 7458d6d

Browse files
dgarskedanielinux
authored andcommitted
Fix for ELF relocation
1 parent 6ca5cb9 commit 7458d6d

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

arch.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,10 @@ endif
682682
ifeq ($(ARCH),PPC)
683683
CROSS_COMPILE?=powerpc-linux-gnu-
684684
LDFLAGS+=-Wl,--build-id=none
685+
# Produce a fully-resolved static ELF (no dynamic relocations).
686+
# Required for JTAG probes that load ELFs but don't process relocations.
687+
CFLAGS+=-fno-pic -fno-pie
688+
LDFLAGS+=-no-pie
685689
CFLAGS+=-DARCH_PPC -DFAST_MEMCPY -ffreestanding -fno-tree-loop-distribute-patterns
686690

687691
ifeq ($(DEBUG_UART),0)

hal/nxp_t2080.ld

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,24 @@ SECTIONS
5353
*(.text*)
5454
*(.rodata*)
5555
*(.sdata*)
56+
KEEP(*(.keystore))
5657
} > FLASH
5758

58-
/* Read-only sections, merged into text segment: */
59-
.interp : { *(.interp) }
60-
.hash : { *(.hash) }
61-
.dynsym : { *(.dynsym) }
62-
.dynstr : { *(.dynstr) }
63-
.gnu.version : { *(.gnu.version) }
64-
.gnu.version_r : { *(.gnu.version_r) }
65-
.gnu.hash : { *(.gnu.hash) }
66-
.rela.dyn : { *(.rela.dyn) }
59+
/* Discard dynamic linking sections - not needed for bare-metal.
60+
* Ensures the ELF has no relocation sections, so JTAG probes
61+
* (e.g. Ronetix PEEDI) can load it without a dynamic linker. */
62+
/DISCARD/ :
63+
{
64+
*(.interp)
65+
*(.hash)
66+
*(.dynsym)
67+
*(.dynstr)
68+
*(.gnu.version)
69+
*(.gnu.version_r)
70+
*(.gnu.hash)
71+
*(.rela.dyn)
72+
*(.rela.plt)
73+
}
6774

6875
/* Store flash location for .ramcode copy */
6976
_stored_ramcode = .;

0 commit comments

Comments
 (0)