![]() |
|
Message-ID: <CAHs-p=ixjP=zUYNYHbGPwhkGwDFN2gyw5y8Lin=NyRe3uUnesw@mail.gmail.com>
Date: Mon, 12 May 2025 16:15:34 +0100
From: Andy Caldwell <andy.m.caldwell@...glemail.com>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] force -fno-lto for CRT files
Hey,
An alternative approach would be to mark the function as `used` which the
attached patch does. Sadly this attribute appears to maybe be a GNU-ism (also
supported in all versions of clang I could find) so maybe it would need a
feature check too to handle other compilers, but this feels like the correct
fix - telling the compiler that the symbol is used rather than disabling
compiler features that misbehave because the compiler can't see the indirect
calls.
Andy
On Mon, May 12, 2025 at 3:14 AM Slava Barinov <rayslava@...il.com> wrote:
>
> Hello,
>
> Okay, I've rechecked the build and it seems that the check should be applied to
> exactly the same objects as NO_SSP flags.
>
> Please find the updated patch.
>
> Best Regards,
> Slava Barinov.
>
> On Sat, Apr 26, 2025 at 3:28 AM Szabolcs Nagy <nsz@...t70.net> wrote:
> >
> > * Slava Barinov <rayslava@...il.com> [2025-04-26 00:38:18 +0900]:
> > > If the library is built using -flto flag the symbol only referenced in inline
> > > assembly is considered unused and therefore is removed.
> > >
> > > Zig compiler has the same issue: https://github.com/ziglang/zig/issues/10364
> >
> > cflags like -fno-lto require configure check, see CFLAGS_NOSSP
> >
> > > ---
> > > Makefile | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 3ad88b35..709c5860 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -127,7 +127,7 @@ NOSSP_OBJS = $(CRT_OBJS) $(LDSO_OBJS) $(filter \
> > > , $(LIBC_OBJS))
> > > $(NOSSP_OBJS) $(NOSSP_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
> > >
> > > -$(CRT_OBJS): CFLAGS_ALL += -DCRT
> > > +$(CRT_OBJS): CFLAGS_ALL += -DCRT -fno-lto
> > >
> > > $(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC
> > >
> > > --
> > > 2.49.0
Download attachment "0001-Mark-__dls2-as-__attribute__-used.patch" of type "application/octet-stream" (1119 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.