From: Jan Dubiec <jdx@o2.pl>
To: Simon Marchi <simark@simark.ca>
Cc: Jan Beulich <jbeulich@suse.com>,
binutils@sourceware.org, gdb-patches@sourceware.org,
Hans-Peter Nilsson <hp@bitrange.com>,
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 09:28:35 +0200 [thread overview]
Message-ID: <7329cb3c-d8a4-40db-bb7e-745f8ea9d95e@o2.pl> (raw)
In-Reply-To: <78e8d2e7-7ed5-4b56-af05-28177f85d63d@simark.ca>
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 ----------------------------------
next prev parent reply other threads:[~2026-09-17 7:30 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 [this message]
2026-09-17 10:02 ` Hans-Peter Nilsson
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=7329cb3c-d8a4-40db-bb7e-745f8ea9d95e@o2.pl \
--to=jdx@o2.pl \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=hp@bitrange.com \
--cc=jbeulich@suse.com \
--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