[PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts
Jan Dubiec
jdx@o2.pl
Sun Aug 23 11:49:55 GMT 2026
This version does not explicitly set the entry symbol; the default one
is used instead. The patch also changes one file in the H8/300 simulator
testsuite, as it is affected by the change to the entry symbol.
The corresponding newlib patch has already been posted: https://inbox.sourceware.org/newlib/20260822001114.1564261-1-jdx@o2.pl/T/#u.
Signed-off-by: Jan Dubiec <jdx@o2.pl>
---
ld/emulparams/h8300elf.sh | 1 +
ld/testsuite/ld-h8300/gcsection.d | 2 +-
ld/testsuite/ld-h8300/gcsection.s | 5 +++--
ld/testsuite/ld-h8300/relax-2.d | 2 +-
ld/testsuite/ld-h8300/relax-2.s | 3 ++-
ld/testsuite/ld-h8300/relax-3.d | 2 +-
ld/testsuite/ld-h8300/relax-3.s | 3 ++-
ld/testsuite/ld-h8300/relax-4.d | 2 +-
ld/testsuite/ld-h8300/relax-4.s | 3 ++-
ld/testsuite/ld-h8300/relax-5.d | 2 +-
ld/testsuite/ld-h8300/relax-5.s | 3 ++-
ld/testsuite/ld-h8300/relax-6.d | 2 +-
ld/testsuite/ld-h8300/relax-6.s | 3 ++-
ld/testsuite/ld-h8300/relax-7.d | 2 +-
ld/testsuite/ld-h8300/relax-7a.s | 3 ++-
ld/testsuite/ld-h8300/relax.d | 2 +-
ld/testsuite/ld-h8300/relax.s | 3 ++-
sim/testsuite/h8300/testutils.inc | 3 ++-
18 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/ld/emulparams/h8300elf.sh b/ld/emulparams/h8300elf.sh
index 45b3458d1ce..dd007fcd0ff 100644
--- a/ld/emulparams/h8300elf.sh
+++ b/ld/emulparams/h8300elf.sh
@@ -9,6 +9,7 @@ MAXPAGESIZE=2
TARGET_PAGE_SIZE=128
ARCH=h8300
TEMPLATE_NAME=elf
+USER_LABEL_PREFIX=_
EMBEDDED=yes
STACK_ADDR=0xfefc
TINY_READONLY_SECTION=".tinyrodata :
diff --git a/ld/testsuite/ld-h8300/gcsection.d b/ld/testsuite/ld-h8300/gcsection.d
index acf39be8d7f..bc6c5bb7677 100644
--- a/ld/testsuite/ld-h8300/gcsection.d
+++ b/ld/testsuite/ld-h8300/gcsection.d
@@ -17,7 +17,7 @@ Disassembly of section .text:
114: mov.l @er7\+,er6
118: rts
-0000011a <_start>:
+0000011a <__?start>:
11a: mov.l er6,@-er7
11e: mov.l er7,er6
120: mov.w #0x4b,r0
diff --git a/ld/testsuite/ld-h8300/gcsection.s b/ld/testsuite/ld-h8300/gcsection.s
index 2149ee99cb4..5574af0f331 100644
--- a/ld/testsuite/ld-h8300/gcsection.s
+++ b/ld/testsuite/ld-h8300/gcsection.s
@@ -29,8 +29,9 @@ _functionWeDontUse:
.size _functionWeDontUse, .-_functionWeDontUse
.section .text.start,"ax",@progbits
.align 1
- .global _start
+ .global _start, __start
_start:
+__start:
mov.l er6,@-er7
mov.l er7,er6
mov.w #75,r0
@@ -39,5 +40,5 @@ _start:
mov.w r2,r0
mov.l @er7+,er6
rts
- .size _start, .-_start
+ .size __start, .-__start
.end
diff --git a/ld/testsuite/ld-h8300/relax-2.d b/ld/testsuite/ld-h8300/relax-2.d
index 7e7964b5c81..c6af620d828 100644
--- a/ld/testsuite/ld-h8300/relax-2.d
+++ b/ld/testsuite/ld-h8300/relax-2.d
@@ -6,7 +6,7 @@
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
100: mov.b @0x64:8,r0l
102: mov.b r0l,@0x64:8
104: mov.b @0x4320:16,r0l
diff --git a/ld/testsuite/ld-h8300/relax-2.s b/ld/testsuite/ld-h8300/relax-2.s
index 8e096b83863..300362cc1ab 100644
--- a/ld/testsuite/ld-h8300/relax-2.s
+++ b/ld/testsuite/ld-h8300/relax-2.s
@@ -1,6 +1,7 @@
.h8300h
- .globl _start
+ .global _start, __start
_start:
+__start:
mov.b @foo:16,r0l
mov.b r0l,@foo:16
mov.b @bar:32,r0l
diff --git a/ld/testsuite/ld-h8300/relax-3.d b/ld/testsuite/ld-h8300/relax-3.d
index f5a9390b785..e537704567b 100644
--- a/ld/testsuite/ld-h8300/relax-3.d
+++ b/ld/testsuite/ld-h8300/relax-3.d
@@ -6,7 +6,7 @@
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
#
# Relaxation of aa:16
#
diff --git a/ld/testsuite/ld-h8300/relax-3.s b/ld/testsuite/ld-h8300/relax-3.s
index f4a2346ab9c..ae94d6c20a1 100644
--- a/ld/testsuite/ld-h8300/relax-3.s
+++ b/ld/testsuite/ld-h8300/relax-3.s
@@ -1,6 +1,7 @@
.h8300s
- .globl _start
+ .global _start, __start
_start:
+__start:
# s3-s6 aren't valid 16-bit addresses.
mov.b @s1:16,r0l
mov.b @s2:16,r0l
diff --git a/ld/testsuite/ld-h8300/relax-4.d b/ld/testsuite/ld-h8300/relax-4.d
index ee80bc39644..001af3b892a 100644
--- a/ld/testsuite/ld-h8300/relax-4.d
+++ b/ld/testsuite/ld-h8300/relax-4.d
@@ -6,7 +6,7 @@
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
100: mov.b #0x3,r0l
102: mov.b #0x5,r2l
104: bset r0l,@0xff:8
diff --git a/ld/testsuite/ld-h8300/relax-4.s b/ld/testsuite/ld-h8300/relax-4.s
index 7d6296da230..bde86590388 100644
--- a/ld/testsuite/ld-h8300/relax-4.s
+++ b/ld/testsuite/ld-h8300/relax-4.s
@@ -1,8 +1,9 @@
; Relaxation is possible for following bit manipulation instructions
; BAND, BCLR, BIAND, BILD, BIOR, BIST, BIXOR, BLD, BNOT, BOR, BSET, BST, BTST, BXOR
.h8300s
- .globl _start
+ .global _start, __start
_start:
+__start:
# s3-s6 aren't valid 16-bit addresses.
mov.b #0x3,r0l
mov.b #0x5,r2l
diff --git a/ld/testsuite/ld-h8300/relax-5.d b/ld/testsuite/ld-h8300/relax-5.d
index 00c4fa89ee4..21ae11ec267 100644
--- a/ld/testsuite/ld-h8300/relax-5.d
+++ b/ld/testsuite/ld-h8300/relax-5.d
@@ -7,7 +7,7 @@
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
100: ldc @0x0:16,ccr
106: ldc @0x7fff:16,ccr
10c: ldc @0x8000:32,ccr
diff --git a/ld/testsuite/ld-h8300/relax-5.s b/ld/testsuite/ld-h8300/relax-5.s
index b5afedbfcca..5a1848732bf 100644
--- a/ld/testsuite/ld-h8300/relax-5.s
+++ b/ld/testsuite/ld-h8300/relax-5.s
@@ -4,11 +4,12 @@
; ldc.w @aa:32,exr
; stc.w exr,@aa:32
.h8300s
- .globl _start
+ .global _start, __start
;
; Relaxation of aa:32
;
_start:
+ __start:
ldc @s1:32,ccr
ldc @s2:32,ccr
ldc @s3:32,ccr
diff --git a/ld/testsuite/ld-h8300/relax-6.d b/ld/testsuite/ld-h8300/relax-6.d
index 54853ef6dbc..77868a3d078 100644
--- a/ld/testsuite/ld-h8300/relax-6.d
+++ b/ld/testsuite/ld-h8300/relax-6.d
@@ -6,6 +6,6 @@
.*: file format .*
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
100: mov.b r2l,@0xbd:8
102: rts
diff --git a/ld/testsuite/ld-h8300/relax-6.s b/ld/testsuite/ld-h8300/relax-6.s
index fb44b54cb1d..dfc9e1c2199 100644
--- a/ld/testsuite/ld-h8300/relax-6.s
+++ b/ld/testsuite/ld-h8300/relax-6.s
@@ -1,5 +1,6 @@
.h8300s
- .global _start
+ .global _start, __start
_start:
+__start:
mov.b r2l,@0xFFFFFFBD:32
rts
diff --git a/ld/testsuite/ld-h8300/relax-7.d b/ld/testsuite/ld-h8300/relax-7.d
index f45787c75ce..f674bfd0906 100644
--- a/ld/testsuite/ld-h8300/relax-7.d
+++ b/ld/testsuite/ld-h8300/relax-7.d
@@ -27,7 +27,7 @@ Contents of section .rodata:
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
100: sub.l er0,er0
102: sub.l er2,er2
104: mov.l #0xffff8000,er1
diff --git a/ld/testsuite/ld-h8300/relax-7a.s b/ld/testsuite/ld-h8300/relax-7a.s
index 915fb79caed..73e3b2bdc77 100644
--- a/ld/testsuite/ld-h8300/relax-7a.s
+++ b/ld/testsuite/ld-h8300/relax-7a.s
@@ -1,9 +1,10 @@
.h8300s
# relax expected
- .global _start
+ .global _start, __start
.section .text.func1,"ax",@progbits
.align 1
_start:
+__start:
sub.l er0,er0
sub.l er2,er2
mov.l #var3,er1
diff --git a/ld/testsuite/ld-h8300/relax.d b/ld/testsuite/ld-h8300/relax.d
index fb863586bfb..7b60728e88d 100644
--- a/ld/testsuite/ld-h8300/relax.d
+++ b/ld/testsuite/ld-h8300/relax.d
@@ -9,7 +9,7 @@
Disassembly of section .text:
-00000100 <_start>:
+00000100 <__?start>:
100: 0d 00.*mov.w r0,r0
102: 47 02.*beq .+2 \(0x106\)
104: 55 02.*bsr .+2 \(0x108\)
diff --git a/ld/testsuite/ld-h8300/relax.s b/ld/testsuite/ld-h8300/relax.s
index b06f3a921c6..eb4e89df64b 100644
--- a/ld/testsuite/ld-h8300/relax.s
+++ b/ld/testsuite/ld-h8300/relax.s
@@ -1,6 +1,7 @@
.text
- .global _start
+ .global _start, __start
_start:
+__start:
mov.w r0,r0
beq .L1
jsr @_bar
diff --git a/sim/testsuite/h8300/testutils.inc b/sim/testsuite/h8300/testutils.inc
index 63d27d45c14..75f318c4d4a 100644
--- a/sim/testsuite/h8300/testutils.inc
+++ b/sim/testsuite/h8300/testutils.inc
@@ -20,8 +20,9 @@
.text
.align 2
- .global _start
+ .global _start, __start
_start:
+__start:
jmp _main
.data
--
2.55.0
More information about the Binutils
mailing list