[v3,1/4] ld: use armelf_phoenix emul for arm-*-phoenix targets

Message ID 20260316110746.1718-1-michal.lach@phoenix-rtos.com
State New
Headers
Series [v3,1/4] ld: use armelf_phoenix emul for arm-*-phoenix targets |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Michal Lach March 16, 2026, 11:07 a.m. UTC
  From: Michał Lach <michal.lach@phoenix-rtos.com>

armelf_phoenix emulation includes redundant definitions which were
previously in defined armelf.

Additionally, armelf_phoenix was unused before this commit in upstream
binutils, and we've been using it for some time already downstream.

Co-authored-by: Hubert Badocha <hubert.badocha@phoenix-rtos.com>
Signed-off-by: Michal Lach <michal.lach@phoenix-rtos.com>
---
 ld/configure.tgt                |  4 +++-
 ld/emulparams/armelf_phoenix.sh | 23 +++--------------------
 2 files changed, 6 insertions(+), 21 deletions(-)
  

Comments

Michal Lach March 16, 2026, 11:26 a.m. UTC | #1
CCing ARM maintainers as per v2 patches.

Michal Lach <michal.lach@phoenix-rtos.com> writes:
> From: Michał Lach <michal.lach@phoenix-rtos.com>
>
> armelf_phoenix emulation includes redundant definitions which were
> previously in defined armelf.
>
> Additionally, armelf_phoenix was unused before this commit in upstream
> binutils, and we've been using it for some time already downstream.
>
> Co-authored-by: Hubert Badocha <hubert.badocha@phoenix-rtos.com>
> Signed-off-by: Michal Lach <michal.lach@phoenix-rtos.com>
> ---
>  ld/configure.tgt                |  4 +++-
>  ld/emulparams/armelf_phoenix.sh | 23 +++--------------------
>  2 files changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/ld/configure.tgt b/ld/configure.tgt
> index 3e158913b89..f65601e1b2e 100644
> --- a/ld/configure.tgt
> +++ b/ld/configure.tgt
> @@ -195,7 +195,9 @@ arm-*-netbsd*)	targ_emul=armelf_nbsd;
>  			;;
>  arm-*-nto*)		targ_emul=armnto
>  			;;
> -arm-*-phoenix*)		targ_emul=armelf
> +arm-*-phoenix*)		targ_emul=armelf_phoenix
> +			targ_extra_emuls="armelf"
> +			targ_extra_libpath=$targ_extra_emuls
>  			;;
>  armeb-*-elf | armeb-*-eabi*)
>  			targ_emul=armelfb
> diff --git a/ld/emulparams/armelf_phoenix.sh b/ld/emulparams/armelf_phoenix.sh
> index 63c35a8290b..0957c745490 100644
> --- a/ld/emulparams/armelf_phoenix.sh
> +++ b/ld/emulparams/armelf_phoenix.sh
> @@ -1,24 +1,7 @@
> -ARCH=arm
> -SCRIPT_NAME=elf
> -OUTPUT_FORMAT="elf32-littlearm"
> -BIG_OUTPUT_FORMAT="elf32-bigarm"
> -LITTLE_OUTPUT_FORMAT="elf32-littlearm"
> -MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
> +source_sh ${srcdir}/emulparams/armelf.sh
>  COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
> -TEMPLATE_NAME=elf
> -EXTRA_EM_FILE=armelf
> -GENERATE_SHLIB_SCRIPT=yes
> -GENERATE_PIE_SCRIPT=yes
> -
> -DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
> -OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)'
> -OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};"
> -OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
> -OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
> -OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
> -
>  TEXT_START_ADDR=0x00001000
>  TARGET2_TYPE=got-rel
>
> -# ARM does not support .s* sections.
> -NO_SMALL_DATA=yes
> +unset STACK_ADDR
> +unset EMBEDDED

--
 - Michal Lach
  
Richard Earnshaw March 16, 2026, 4:13 p.m. UTC | #2
On 16/03/2026 11:07, Michal Lach wrote:
> From: Michał Lach <michal.lach@phoenix-rtos.com>
> 
> armelf_phoenix emulation includes redundant definitions which were
> previously in defined armelf.
> 
> Additionally, armelf_phoenix was unused before this commit in upstream
> binutils, and we've been using it for some time already downstream.
> 
> Co-authored-by: Hubert Badocha <hubert.badocha@phoenix-rtos.com>
> Signed-off-by: Michal Lach <michal.lach@phoenix-rtos.com>

LGTM

R.
> ---
>   ld/configure.tgt                |  4 +++-
>   ld/emulparams/armelf_phoenix.sh | 23 +++--------------------
>   2 files changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/ld/configure.tgt b/ld/configure.tgt
> index 3e158913b89..f65601e1b2e 100644
> --- a/ld/configure.tgt
> +++ b/ld/configure.tgt
> @@ -195,7 +195,9 @@ arm-*-netbsd*)	targ_emul=armelf_nbsd;
>   			;;
>   arm-*-nto*)		targ_emul=armnto
>   			;;
> -arm-*-phoenix*)		targ_emul=armelf
> +arm-*-phoenix*)		targ_emul=armelf_phoenix
> +			targ_extra_emuls="armelf"
> +			targ_extra_libpath=$targ_extra_emuls
>   			;;
>   armeb-*-elf | armeb-*-eabi*)
>   			targ_emul=armelfb
> diff --git a/ld/emulparams/armelf_phoenix.sh b/ld/emulparams/armelf_phoenix.sh
> index 63c35a8290b..0957c745490 100644
> --- a/ld/emulparams/armelf_phoenix.sh
> +++ b/ld/emulparams/armelf_phoenix.sh
> @@ -1,24 +1,7 @@
> -ARCH=arm
> -SCRIPT_NAME=elf
> -OUTPUT_FORMAT="elf32-littlearm"
> -BIG_OUTPUT_FORMAT="elf32-bigarm"
> -LITTLE_OUTPUT_FORMAT="elf32-littlearm"
> -MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
> +source_sh ${srcdir}/emulparams/armelf.sh
>   COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
> -TEMPLATE_NAME=elf
> -EXTRA_EM_FILE=armelf
> -GENERATE_SHLIB_SCRIPT=yes
> -GENERATE_PIE_SCRIPT=yes
> -
> -DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
> -OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)'
> -OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};"
> -OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
> -OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
> -OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
> -
>   TEXT_START_ADDR=0x00001000
>   TARGET2_TYPE=got-rel
>   
> -# ARM does not support .s* sections.
> -NO_SMALL_DATA=yes
> +unset STACK_ADDR
> +unset EMBEDDED
  

Patch

diff --git a/ld/configure.tgt b/ld/configure.tgt
index 3e158913b89..f65601e1b2e 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -195,7 +195,9 @@  arm-*-netbsd*)	targ_emul=armelf_nbsd;
 			;;
 arm-*-nto*)		targ_emul=armnto
 			;;
-arm-*-phoenix*)		targ_emul=armelf
+arm-*-phoenix*)		targ_emul=armelf_phoenix
+			targ_extra_emuls="armelf"
+			targ_extra_libpath=$targ_extra_emuls
 			;;
 armeb-*-elf | armeb-*-eabi*)
 			targ_emul=armelfb
diff --git a/ld/emulparams/armelf_phoenix.sh b/ld/emulparams/armelf_phoenix.sh
index 63c35a8290b..0957c745490 100644
--- a/ld/emulparams/armelf_phoenix.sh
+++ b/ld/emulparams/armelf_phoenix.sh
@@ -1,24 +1,7 @@ 
-ARCH=arm
-SCRIPT_NAME=elf
-OUTPUT_FORMAT="elf32-littlearm"
-BIG_OUTPUT_FORMAT="elf32-bigarm"
-LITTLE_OUTPUT_FORMAT="elf32-littlearm"
-MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
+source_sh ${srcdir}/emulparams/armelf.sh
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-TEMPLATE_NAME=elf
-EXTRA_EM_FILE=armelf
-GENERATE_SHLIB_SCRIPT=yes
-GENERATE_PIE_SCRIPT=yes
-
-DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
-OTHER_TEXT_SECTIONS='*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)'
-OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__bss_start__ = .${CREATE_SHLIB+)};"
-OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_bss_end__ = .${CREATE_SHLIB+)}; ${CREATE_SHLIB+PROVIDE (}__bss_end__ = .${CREATE_SHLIB+)};"
-OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
-OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
-
 TEXT_START_ADDR=0x00001000
 TARGET2_TYPE=got-rel
 
-# ARM does not support .s* sections.
-NO_SMALL_DATA=yes
+unset STACK_ADDR
+unset EMBEDDED