Re: [PATCH] selftests/nolibc: add tests for multi-object linkage

From: Paul E. McKenney
Date: Mon Oct 16 2023 - 12:37:57 EST


On Thu, Oct 12, 2023 at 01:18:18PM -0700, Paul E. McKenney wrote:
> On Thu, Oct 12, 2023 at 09:34:53PM +0200, Thomas Weißschuh wrote:
> > On 2023-10-12 12:06:33-0700, Paul E. McKenney wrote:
> > > On Thu, Oct 12, 2023 at 08:39:14PM +0200, Thomas Weißschuh wrote:
> > > > On 2023-10-12 11:25:02-0700, Paul E. McKenney wrote:
> > > > > [..]
> >
> > > > > I have a signed tag urgent/nolibc.2023.10.12a in the -rcu tree, so
> > > > > please check the lead-in text for sanity. (Everything after the digital
> > > > > signature is automatically generated.)
> > > >
> > > > Looks good. But it's only a listing of the commit subjects, correct?
> > >
> > > Pretty close, just a few added words on the last one.
> > >
> > > So the question is whether there is some larger issue that Linus should
> > > be made aware of. If these are just simple fixes for simple bugs,
> > > we should be good, but yes, I do need to ask. ;-)
> >
> > These are simple fixes for simple bugs.
> >
> > Do you always have to ask specifically or can I just mention it in the
> > pull request in the future?
>
> I would be extremely happy to simply copy text from the pull request
> into the signed tags. ;-)
>
> We would just need to agree on the format. For example, in this case,
> there will eventually be two signed tags, one for the urgent pull
> request early next week and another for the pull request for the upcoming
> merge window.
>
> Proposals for the format?

Actually, proposals for the signed-tag text for the urgent commits?
Left to myself, I would use the same text shown below that I proposed
last week.

Thanx, Paul

------------------------------------------------------------------------

tag urgent/nolibc.2023.10.12a
Tagger: Paul E. McKenney <paulmck@xxxxxxxxxx>
Date: Thu Oct 12 10:50:08 2023 -0700

Urgent pull request for nolibc into v6.6

This pull request contains the following fixes:

o tools/nolibc: i386: Fix a stack misalign bug on _start

o MAINTAINERS: nolibc: update tree location

o tools/nolibc: mark start_c as weak to avoid linker errors

MAINTAINERS | 2 +-
tools/include/nolibc/arch-i386.h | 4 +++-
tools/include/nolibc/crt.h | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
-----BEGIN PGP SIGNATURE-----

iQJHBAABCgAxFiEEbK7UrM+RBIrCoViJnr8S83LZ+4wFAmUoMqATHHBhdWxtY2tA
a2VybmVsLm9yZwAKCRCevxLzctn7jAE9D/9aa/OzGPI9VFKcN1gIW8dYJnXvSI3n
+gUMjRhlWnx2DBxBkpg7jmiPUXySlsOzHoo9sgtMuOVXhkdmODZ5RL7drKJXNqxs
xmpb70mftOtj/+qx3CEj71K45t5pkwidRTwOuwcNGOGM4xb6sw7kVCWinsKGSPjh
l8pcJxquY2ZcKKp1OciT37IYw6AcWUz4v/JCeKLOg9FFlxIrenR56u41f7OR0GM/
D1kggSHuwAk+b0BmnUXEig2Ys0bORZ1sRQnTHjQEmba4kr41DzarwdIXMU2LUS3m
dIxTtSs8kRSRZ21A9rGNEnezwZaYVdRraH3LQcDYQ4lsaccZc7xUICzHwj/DVri1
PkHVrZzii/PZGIADLYEn1ob9PjbuPXbpf6p1xZsnOCaKv1n4DcG2fHsIsCTptHkr
qT8+DDu2x74WiD+lAaEuOJV1UeCDjQrTyrK2Impvg1af/d0xS6hUvDeap09OhLpW
odLgtpO5xRLsWFrKl/FGCZIsLXUkvpn3F2FfU3nLgFWMFiuw6Nkk+hLlr34WqTGs
A+LRYktd8moFPJRzUhgOr1jZpy8SUhs3MRWlfJ3I3FHQvCYFDX95xHsl5brZ3Vkp
UAfRPpJmJYfIzhfj7kQZQFJ+mCIfRI0jb+6VyF/u9/MaicfMes4YlUwKEUGBbx+f
rrUmEilQCZd3Sw==
=Wnux
-----END PGP SIGNATURE-----

commit 90864f0679fdbb3b2e1c3bdbe4b0a34df785cb0a
Author: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Date: Thu Oct 12 00:37:38 2023 +0200

tools/nolibc: mark start_c as weak

Otherwise the different instances of _start_c from each compilation unit
will lead to linker errors:

/usr/bin/ld: /tmp/ccSNvRqs.o: in function `_start_c':
nolibc-test-foo.c:(.text.nolibc_memset+0x9): multiple definition of `_start_c'; /tmp/ccG25101.o:nolibc-test.c:(.text+0x1ea3): first defined here

Fixes: 17336755150b ("tools/nolibc: add new crt.h with _start_c")
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Link: https://lore.kernel.org/lkml/20231012-nolibc-start_c-multiple-v1-1-fbfc73e0283f@xxxxxxxxxxxxxx/
Link: https://lore.kernel.org/lkml/20231012-nolibc-linkage-test-v1-1-315e682768b4@xxxxxxxxxxxxxx/
Acked-by: Willy Tarreau <w@xxxxxx>

diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h
index a5f33fef1672..a05655b4ce1d 100644
--- a/tools/include/nolibc/crt.h
+++ b/tools/include/nolibc/crt.h
@@ -13,6 +13,7 @@ const unsigned long *_auxv __attribute__((weak));
static void __stack_chk_init(void);
static void exit(int);

+__attribute__((weak))
void _start_c(long *sp)
{
long argc;