From: Nicholas Vinson <nvinson234@gmail.com>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: grub-devel@gnu.org, floppym@gentoo.org
Subject: Re: [PATCH v2 0/8] Improve ld.lld-21+ compatibility when building i386-pc target
Date: Tue, 10 Feb 2026 18:27:49 -0500 [thread overview]
Message-ID: <5d473776-e5dc-402e-8038-e395ae42821a@gmail.com> (raw)
In-Reply-To: <20260210154741.6zzavjzf3pr3qw2h@tomti.i.net-space.pl>
On 2/10/26 10:47, Daniel Kiper wrote:
> On Mon, Feb 09, 2026 at 07:43:28PM -0500, Nicholas Vinson wrote:
>> Starting with ld.llvm-21, any attempt create a non-relocatable binary and set
>> one more secton addresses below 0x400000 results in a linker error. Furthermore,
>> the differences between ld.bfd and ld.lld made finding a proper set of
>> command-line flags tht worked with both linkers and bypass the image base
>> address restriction difficult. Therefore, the approach of using a custom linker
>> script was adopted to solve the issue.
>>
>> This approach was tested using:
>>
>> ../configure CC=clang CXX=clang++ LDFLAGS="-fuse-ld=lld" TARGET_LDFLAGS="-fuse-ld=lld" --with-platform=pc
>> ../configure CC=clang CXX=clang++ --with-platform=pc (both with ld.lld as the default and ld.bfd as the default)
>> ../configure CC=gcc CXX=g++ --with-platform=pc
>>
>> and a VM was used for testing. To build the disk images the VM was booted with,
>> the following scripts were used:
>
> [...]
>
>> In all cases, the VM successfully booted to the standard GRUB prompt.
>>
>> Nicholas Vinson (8):
>> i386/pc/int.h: conditionally apply regparm attr.
>> grub-core: Update kernel image generation
>> i386-cygwin-img-ld.sc -> i386-cygwin-img.lds
>> Revert "configure: Print a more helpful error if autoconf-archive is
>> not installed"
>> Revert "configure: Check linker for --image-base support"
>> Revert "INSTALL: Add note that the GNU Autoconf Archive may be needed"
>> configure: drop -Ttext checks for i386-pc
>
> For all these patches Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...
>
>> C23 fixes: fix strchr() and strrchr() handling
>
> It seems to me that this patch does more than commit message says.
> I think it has to be split into more parts or commit message has to be
> improved.
I admit the message is a bit terse, but I kept the changes to a minimum.
I did, however, forget to mention strstr().
Put simply, with C23, if the first argument to strstr(), strchr(), or
strrchar() is a const char *, the result is a const char *. C23 also
made this change to about 9 or so other functions.
As a result, most of the changes were just changing a variable from
'char *' to 'const char *'.
The changes for ofpath.c are a bit more involved because the original
code would modify the string 'ed' pointed to. With C23, ed needs to be a
'const char *' because sysfs_path is a 'const char *'. This also means
that the line "*q = '\0'" is no longer valid because you cannot safely
modify a const char string.
I saw two options to fix this, the first was to modify the line to be q
= strndup(...);, add the requisite error checking, and then make sure to
free q just before every subsequent return. The second option, is what I
did, find the difference between q and ed, save it off, and then replace
the strlen(ed) calls with that difference.
I believe the second approach is the better of the two. It did have the
ancillary effect of updating a few snprintf() calls and the path_size
calculation; however, these changes are required with this approach.
If you'd prefer, I can re-submit patch 8 with these details in the
commit message. Alternatively, if you would prefer the strndup()
approach, I will respin this patch series without patch 8, and then
submit a re-worked C23 patch as a separate request.
Thanks,
Nicholas Vinson
>
> Daniel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2026-02-10 23:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 0:43 [PATCH v2 0/8] Improve ld.lld-21+ compatibility when building i386-pc target Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 1/8] i386/pc/int.h: conditionally apply regparm attr Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 2/8] grub-core: Update kernel image generation Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 3/8] i386-cygwin-img-ld.sc -> i386-cygwin-img.lds Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 4/8] Revert "configure: Print a more helpful error if autoconf-archive is not installed" Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 5/8] Revert "configure: Check linker for --image-base support" Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 6/8] Revert "INSTALL: Add note that the GNU Autoconf Archive may be needed" Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 7/8] configure: drop -Ttext checks for i386-pc Nicholas Vinson
2026-02-10 0:43 ` [PATCH v2 8/8] C23 fixes: fix strchr() and strrchr() handling Nicholas Vinson
2026-02-10 15:47 ` [PATCH v2 0/8] Improve ld.lld-21+ compatibility when building i386-pc target Daniel Kiper
2026-02-10 23:27 ` Nicholas Vinson [this message]
2026-02-11 17:49 ` Daniel Kiper
2026-02-12 7:46 ` [PATCH] Fix build with glibc 2.43 after new ISO C23 changes Radoslav Kolev via Grub-devel
2026-02-12 7:53 ` [PATCH v2 0/8] Improve ld.lld-21+ compatibility when building i386-pc target Radoslav Kolev via Grub-devel
2026-02-12 13:21 ` Nicholas Vinson
2026-02-11 18:49 ` Daniel Kiper
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=5d473776-e5dc-402e-8038-e395ae42821a@gmail.com \
--to=nvinson234@gmail.com \
--cc=dkiper@net-space.pl \
--cc=floppym@gentoo.org \
--cc=grub-devel@gnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.