Make ldscript cross-platform.

This commit is contained in:
dxl
2026-08-19 15:51:18 +02:00
committed by Philippe Teuwen
parent d59e96e09e
commit 3cc2f7e59b
5 changed files with 118 additions and 64 deletions
-64
View File
@@ -1,64 +0,0 @@
/*
-----------------------------------------------------------------------------
This code is licensed to you under the terms of the GNU GPL, version 2 or,
at your option, any later version. See the LICENSE.txt file for the text of
the license.
-----------------------------------------------------------------------------
Linker script for the ARM binary
-----------------------------------------------------------------------------
*/
INCLUDE ../common_arm/ldscript.common
PHDRS
{
text PT_LOAD FLAGS(5);
data PT_LOAD;
bss PT_LOAD;
}
ENTRY(Vector)
SECTIONS
{
.start : {
*(.startos)
} >osimage :text
.text : {
*(.text)
*(.text.*)
*(.eh_frame)
*(.glue_7)
*(.glue_7t)
} >osimage :text
.rodata : {
*(.rodata)
*(.rodata.*)
*(fpga_all_bit.data)
. = ALIGN(8);
} >osimage :text
.data : {
*(.data)
*(.data.*)
*(.ramfunc)
. = ALIGN(4);
} >ram AT>osimage :data
__data_src_start__ = LOADADDR(.data);
__data_start__ = ADDR(.data);
__data_end__ = __data_start__ + SIZEOF(.data);
__os_size__ = SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata);
.bss : {
__bss_start__ = .;
*(.bss)
*(.bss.*)
. = ALIGN(4);
__bss_end__ = .;
} >ram AT>ram :bss
.commonarea (NOLOAD) : {
*(.commonarea)
} >commonarea :NONE
}
+29
View File
@@ -0,0 +1,29 @@
/*
-----------------------------------------------------------------------------
This code is licensed to you under the terms of the GNU GPL, version 2 or,
at your option, any later version. See the LICENSE.txt file for the text of
the license.
-----------------------------------------------------------------------------
Linker script for the ARM binary
-----------------------------------------------------------------------------
*/
INCLUDE ../common_arm/ldscript.defs.at32
INCLUDE ../common_arm/ldscript.common
INCLUDE ./ldscript.osimage.phdrs
ENTRY(Reset_Handler)
SECTIONS
{
/* The startup code goes first into FLASH, AT32 is startup from 'startup_at32f435_437.s' */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >osimage :text
}
INCLUDE ./ldscript.osimage.sections
+18
View File
@@ -0,0 +1,18 @@
/*
-----------------------------------------------------------------------------
This code is licensed to you under the terms of the GNU GPL, version 2 or,
at your option, any later version. See the LICENSE.txt file for the text of
the license.
-----------------------------------------------------------------------------
Linker script for the ARM binary
-----------------------------------------------------------------------------
*/
INCLUDE ../common_arm/ldscript.defs.at91
INCLUDE ../common_arm/ldscript.common
INCLUDE ./ldscript.osimage.phdrs
ENTRY(Vector)
INCLUDE ./ldscript.osimage.sections
+6
View File
@@ -0,0 +1,6 @@
PHDRS
{
text PT_LOAD FLAGS(5);
data PT_LOAD;
bss PT_LOAD;
}
+65
View File
@@ -0,0 +1,65 @@
/*-----------------------------------------------------------------------------
* Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See LICENSE.txt for the text of the license.
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Common linker script, for os image for sections.
*-----------------------------------------------------------------------------
*/
SECTIONS
{
.start : {
*(.startos)
} >osimage :text
.text : {
*(.text)
*(.text.*)
*(.eh_frame)
*(.glue_7)
*(.glue_7t)
} >osimage :text
.rodata : {
*(.rodata)
*(.rodata.*)
*(fpga_all_bit.data)
. = ALIGN(8);
} >osimage :text
.data : {
*(.data)
*(.data.*)
*(.ramfunc)
. = ALIGN(4);
} >ram AT>osimage :data
__data_src_start__ = LOADADDR(.data);
__data_start__ = ADDR(.data);
__data_end__ = __data_start__ + SIZEOF(.data);
__os_size__ = SIZEOF(.text) + SIZEOF(.data) + SIZEOF(.rodata);
.bss : {
__bss_start__ = .;
*(.bss)
*(.bss.*)
. = ALIGN(4);
__bss_end__ = .;
} >ram AT>ram :bss
.commonarea (NOLOAD) : {
*(.commonarea)
} >commonarea :NONE
}