Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251118021720.GQ1827@brightrain.aerifal.cx>
Date: Mon, 17 Nov 2025 21:17:21 -0500
From: Rich Felker <dalias@...c.org>
To: Bill Roberts <bill.roberts@...s.arm.com>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH 2/3] Makefile: support awk processing of .S files

On Fri, Nov 14, 2025 at 12:38:03AM -0600, Bill Roberts wrote:
> 
> 
> On 11/14/25 10:23 AM, Szabolcs Nagy wrote:
> > * Bill Roberts <bill.roberts@....com> [2025-11-13 13:44:27 -0600]:
> > > Don't skip .S files when post-processing with awk.
> > > 
> > > Signed-off-by: Bill Roberts <bill.roberts@....com>
> > > ---
> > >   Makefile | 6 ++++--
> > >   1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/Makefile b/Makefile
> > > index a20bafaf..4e62e0b3 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -136,15 +136,17 @@ CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $<
> > >   # Choose invocation of assembler to be used
> > >   ifeq ($(ADD_CFI),yes)
> > >   	AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ -
> > > +	CCS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler-with-cpp -c -o $@ -
> > >   else
> > >   	AS_CMD = $(CC_CMD)
> > > +	CCS_CMD = $(CC_CMD)
> > >   endif
> > >   obj/%.o: $(srcdir)/%.s
> > >   	$(AS_CMD)
> > >   obj/%.o: $(srcdir)/%.S
> > > -	$(CC_CMD)
> > > +	$(CCS_CMD)
> > 
> > i think the x86 cfi awk deletes # and // comments
> > which affects cpp directives in .S so you cant just
> > use the awk on .S
> > 
> > i guess a hack would be to not use # comments in .s,
> > another to only preprocess first then awk then asm.
> > 
> 
> Personally, I would love to see all of this go to .S (capital)
> files and use the C pre-processor for all of this and add the CFI
> statements directly to the asm. However, it seems MUSL want's the assembly
> to be "pure" based on the comments and git logs I am
> seeing. I am more of a fan of seeing everything in the assembly file then
> chasing down custom scripts that do processing, but I'll do it whatever way
> the community/maintainers want.

I don't want more preprocessing scripts. The ones that are there are
there for optional debug functionality, not for anything that alters
behavior, and it would probably be nicer if we didn't need them.

At the same time, I don't want asm source files that require reading
include files to interpret what anything means. The long term goal is
to eliminate as many asm source files as possible, and it might make
sense to do this before doing anything that requires a lot of
redundant work on the existing ones. Really the only things that
should be asm source files rather than inline asm are things that need
to have an asm entry point/label in order to function -- things like
__syscal_cp_asm, __unmapself, etc.

Rich

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.