* [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
@ 2026-08-23 20:10 Jan Dubiec
2026-08-24 0:52 ` Alan Modra
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Jan Dubiec @ 2026-08-23 20:10 UTC (permalink / raw)
To: Alan Modra; +Cc: Jan Dubiec, Jan Beulich, binutils, gdb-patches
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 patch has therefore
also been posted to the gdb-patches mailing list for approval.
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-08-23 20:10 [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST] Jan Dubiec
@ 2026-08-24 0:52 ` Alan Modra
2026-09-15 9:16 ` [PING] " Jan Dubiec
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Alan Modra @ 2026-08-24 0:52 UTC (permalink / raw)
To: Jan Dubiec; +Cc: Jan Beulich, binutils, gdb-patches
On Sun, Aug 23, 2026 at 10:10:24PM +0200, Jan Dubiec wrote:
> 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 patch has therefore
> also been posted to the gdb-patches mailing list for approval.
>
> 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(-)
OK.
--
Alan Modra
^ permalink raw reply [flat|nested] 9+ messages in thread* [PING] [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-08-23 20:10 [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST] Jan Dubiec
2026-08-24 0:52 ` Alan Modra
@ 2026-09-15 9:16 ` Jan Dubiec
2026-09-16 4:46 ` Hans-Peter Nilsson
2026-09-16 14:58 ` Simon Marchi
3 siblings, 0 replies; 9+ messages in thread
From: Jan Dubiec @ 2026-09-15 9:16 UTC (permalink / raw)
To: gdb-patches; +Cc: binutils, Alan Modra
Gentle ping. Although this patch modifies files in both binutils and the
H8/300 simulator testsuite, it constitutes a single logical change. The
binutils part has already been accepted, and now only the small and
straightforward change to the simulator testsuite awaits approval from a
gdb/sim maintainer.
/J.D.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-08-23 20:10 [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST] Jan Dubiec
2026-08-24 0:52 ` Alan Modra
2026-09-15 9:16 ` [PING] " Jan Dubiec
@ 2026-09-16 4:46 ` Hans-Peter Nilsson
2026-09-16 14:58 ` Simon Marchi
3 siblings, 0 replies; 9+ messages in thread
From: Hans-Peter Nilsson @ 2026-09-16 4:46 UTC (permalink / raw)
To: Jan Dubiec; +Cc: Alan Modra, Jan Beulich, binutils, gdb-patches
Regarding your recent ping for a gdb maintainer for this part
of your patch:
On Sun, 23 Aug 2026, Jan Dubiec wrote:
> 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 patch has therefore
> also been posted to the gdb-patches mailing list for approval.
>
> The corresponding newlib patch has already been posted: https://inbox.sourceware.org/newlib/20260822001114.1564261-1-jdx@o2.pl/T/#u.
> 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
>
I see in sim/MAINTAINERS clarified by gdb/MAINTAINERS that I'm
"invited to do so" wrt. reviewing patches as an "authorized
committer" for "*" in sim, so I'll "do so". The
sim/testutils.inc part of the patch is approved.
Thanks.
brgds, H-P
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-08-23 20:10 [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST] Jan Dubiec
` (2 preceding siblings ...)
2026-09-16 4:46 ` Hans-Peter Nilsson
@ 2026-09-16 14:58 ` Simon Marchi
2026-09-17 0:48 ` Hans-Peter Nilsson
2026-09-17 7:28 ` Jan Dubiec
3 siblings, 2 replies; 9+ messages in thread
From: Simon Marchi @ 2026-09-16 14:58 UTC (permalink / raw)
To: Jan Dubiec, Alan Modra; +Cc: Jan Beulich, binutils, gdb-patches
On 2026-08-23 16:10, Jan Dubiec wrote:
> 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 patch has therefore
> also been posted to the gdb-patches mailing list for approval.
>
> 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>
Looks like the change was OK'ed by the relevant people. However, could
you please make the commit message actually describe the change?
Thanks,
Simon
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-09-16 14:58 ` Simon Marchi
@ 2026-09-17 0:48 ` Hans-Peter Nilsson
2026-09-17 7:28 ` Jan Dubiec
1 sibling, 0 replies; 9+ messages in thread
From: Hans-Peter Nilsson @ 2026-09-17 0:48 UTC (permalink / raw)
To: Simon Marchi; +Cc: Jan Dubiec, Alan Modra, Jan Beulich, binutils, gdb-patches
On Wed, 16 Sep 2026, Simon Marchi wrote:
> On 2026-08-23 16:10, Jan Dubiec wrote:
> > 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 patch has therefore
> > also been posted to the gdb-patches mailing list for approval.
> >
> > 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>
>
> Looks like the change was OK'ed by the relevant people. However, could
> you please make the commit message actually describe the change?
A good idea. Sorry I missed that in my review.
brgds, H-P
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-09-16 14:58 ` Simon Marchi
2026-09-17 0:48 ` Hans-Peter Nilsson
@ 2026-09-17 7:28 ` Jan Dubiec
2026-09-17 10:02 ` Hans-Peter Nilsson
1 sibling, 1 reply; 9+ messages in thread
From: Jan Dubiec @ 2026-09-17 7:28 UTC (permalink / raw)
To: Simon Marchi
Cc: Jan Beulich, binutils, gdb-patches, Hans-Peter Nilsson, Alan Modra
On 16.09.2026 16:58, Simon Marchi wrote:
[...]> Looks like the change was OK'ed by the relevant people. However,
could
> you please make the commit message actually describe the change?
>
> Thanks,
>
> Simon
I am not sure how the commit message should be posted, so here it is. I
hope it will not be a problem for whoever commits the patch to copy and
paste the message below.
/J.D.
-------------------------- CUT HERE ----------------------------------
This patch is a spin-off from the following thread:
https://inbox.sourceware.org/newlib/CAOox84s_SjpbEZsAx9EprDrTxB-bT0pgbavt8NXY7iiph8h6Vg@mail.gmail.com/T/#t
.
Bare-metal h8300-elf-gcc sets USER_LABEL_PREFIX:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/h8300/elf.h;hb=HEAD.
Strangely, ld does not. As a result, ld exports symbols without
a leading underscore, while GCC expects them to have one. For example:
linker scirpt:
[...]
PROVIDE_HIDDEN (__preinit_array_start = .);
[...]
C source code (the compiler adds 3rd underscore):
[...]
extern void (*__preinit_array_start []) (void) __attribute__((weak));
[...]
This can lead to sneaky bugs when the symbol is declared as weak. It
also creates maintenance issues when the C code is intended to be
portable across multiple platforms.
The patch defines USER_LABEL_PREFIX accordingly and updates the linker
and H8/300 simulator test cases to reflect this change.
The corresponding newlib patch has already been posted and accepted:
https://inbox.sourceware.org/newlib/20260822001114.1564261-1-jdx@o2.pl/T/#u.
Signed-off-by: Jan Dubiec <jdx@o2.pl>
-------------------------- CUT HERE ----------------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-09-17 7:28 ` Jan Dubiec
@ 2026-09-17 10:02 ` Hans-Peter Nilsson
2026-09-17 13:18 ` Simon Marchi
0 siblings, 1 reply; 9+ messages in thread
From: Hans-Peter Nilsson @ 2026-09-17 10:02 UTC (permalink / raw)
To: Jan Dubiec; +Cc: Simon Marchi, Jan Beulich, binutils, gdb-patches, Alan Modra
On Thu, 17 Sep 2026, Jan Dubiec wrote:
> On 16.09.2026 16:58, Simon Marchi wrote:
> [...]> Looks like the change was OK'ed by the relevant people. However, could
> > you please make the commit message actually describe the change?
> >
> > Thanks,
> >
> > Simon
>
> I am not sure how the commit message should be posted, so here it is.
The usual way is that you, after editing the commit message and
amending the commit, send it together with the rest of the
patch, in form of an in-line copy of the file generated by "git
format-patch [...]".
But the below works and LGTM, so ok.
> I hope
> it will not be a problem for whoever commits the patch to copy and paste the
> message below.
Oh, you don't have commit rights. I'll do it, if no-one beats
me to it.
brgds, H-P
>
> /J.D.
>
> -------------------------- CUT HERE ----------------------------------
> This patch is a spin-off from the following thread:
> https://inbox.sourceware.org/newlib/CAOox84s_SjpbEZsAx9EprDrTxB-bT0pgbavt8NXY7iiph8h6Vg@mail.gmail.com/T/#t
> .
>
> Bare-metal h8300-elf-gcc sets USER_LABEL_PREFIX:
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/h8300/elf.h;hb=HEAD.
> Strangely, ld does not. As a result, ld exports symbols without
> a leading underscore, while GCC expects them to have one. For example:
>
> linker scirpt:
> [...]
> PROVIDE_HIDDEN (__preinit_array_start = .);
> [...]
>
> C source code (the compiler adds 3rd underscore):
> [...]
> extern void (*__preinit_array_start []) (void) __attribute__((weak));
> [...]
>
> This can lead to sneaky bugs when the symbol is declared as weak. It
> also creates maintenance issues when the C code is intended to be
> portable across multiple platforms.
>
> The patch defines USER_LABEL_PREFIX accordingly and updates the linker
> and H8/300 simulator test cases to reflect this change.
>
> The corresponding newlib patch has already been posted and accepted:
> https://inbox.sourceware.org/newlib/20260822001114.1564261-1-jdx@o2.pl/T/#u.
>
> Signed-off-by: Jan Dubiec <jdx@o2.pl>
> -------------------------- CUT HERE ----------------------------------
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
2026-09-17 10:02 ` Hans-Peter Nilsson
@ 2026-09-17 13:18 ` Simon Marchi
0 siblings, 0 replies; 9+ messages in thread
From: Simon Marchi @ 2026-09-17 13:18 UTC (permalink / raw)
To: Hans-Peter Nilsson, Jan Dubiec
Cc: Jan Beulich, binutils, gdb-patches, Alan Modra
On 9/17/26 6:02 AM, Hans-Peter Nilsson wrote:
> On Thu, 17 Sep 2026, Jan Dubiec wrote:
>> On 16.09.2026 16:58, Simon Marchi wrote:
>> [...]> Looks like the change was OK'ed by the relevant people. However, could
>>> you please make the commit message actually describe the change?
>>>
>>> Thanks,
>>>
>>> Simon
>>
>> I am not sure how the commit message should be posted, so here it is.
>
> The usual way is that you, after editing the commit message and
> amending the commit, send it together with the rest of the
> patch, in form of an in-line copy of the file generated by "git
> format-patch [...]".
And / or git-send-email.
> But the below works and LGTM, so ok.
>
>> I hope
>> it will not be a problem for whoever commits the patch to copy and paste the
>> message below.
>
> Oh, you don't have commit rights. I'll do it, if no-one beats
> me to it.
Thanks, please go ahead.
Simon
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-09-17 13:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-23 20:10 [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST] Jan Dubiec
2026-08-24 0:52 ` Alan Modra
2026-09-15 9:16 ` [PING] " Jan Dubiec
2026-09-16 4:46 ` Hans-Peter Nilsson
2026-09-16 14:58 ` Simon Marchi
2026-09-17 0:48 ` Hans-Peter Nilsson
2026-09-17 7:28 ` Jan Dubiec
2026-09-17 10:02 ` Hans-Peter Nilsson
2026-09-17 13:18 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox