From: Hans-Peter Nilsson <hp@bitrange.com>
To: Jan Dubiec <jdx@o2.pl>
Cc: Simon Marchi <simark@simark.ca>, Jan Beulich <jbeulich@suse.com>,
binutils@sourceware.org, gdb-patches@sourceware.org,
Alan Modra <amodra@gmail.com>
Subject: Re: [PATCH v3] h8300-elf: ld: Use USER_LABEL_PREFIX when generating linker scripts [REPOST]
Date: Thu, 17 Sep 2026 06:02:25 -0400 (EDT) [thread overview]
Message-ID: <alpine.BSF.2.20.16.2609170555310.70026@arjuna.pair.com> (raw)
In-Reply-To: <7329cb3c-d8a4-40db-bb7e-745f8ea9d95e@o2.pl>
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 ----------------------------------
>
>
next prev parent reply other threads:[~2026-09-17 10:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 20:10 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 [this message]
2026-09-17 13:18 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.BSF.2.20.16.2609170555310.70026@arjuna.pair.com \
--to=hp@bitrange.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=jbeulich@suse.com \
--cc=jdx@o2.pl \
--cc=simark@simark.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox