From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7640 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v3] Build process uses script to add CFI directives to x86 asm Date: Thu, 14 May 2015 12:25:39 +0200 Message-ID: <20150514102538.GG31118@port70.net> References: <1431539679-4265-1-git-send-email-alexinbeijing@gmail.com> <20150513192252.GF31118@port70.net> <20150514025720.GB17573@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1431599159 9758 80.91.229.3 (14 May 2015 10:25:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 May 2015 10:25:59 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7652-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 14 12:25:55 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YsqKv-00019H-V2 for gllmg-musl@m.gmane.org; Thu, 14 May 2015 12:25:54 +0200 Original-Received: (qmail 25973 invoked by uid 550); 14 May 2015 10:25:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25955 invoked from network); 14 May 2015 10:25:50 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20150514025720.GB17573@brightrain.aerifal.cx> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:7640 Archived-At: * Rich Felker [2015-05-13 22:57:20 -0400]: > On Wed, May 13, 2015 at 09:22:52PM +0200, Szabolcs Nagy wrote: > > * Alex Dowad [2015-05-13 19:54:39 +0200]: > > > > > > I've noticed that using tempfiles for the augmented asm has a drawback: > > > In the source file/line debugging info generated by the assembler, it records > > > the source file as "/tmp/". Then, when you try to debug a program > > > which is linked against the resulting musl, GDB tries to open "/tmp/" > > > to show in the source window. > > > > > > Suggestions?? Perhaps generate .cfi.s files as Szabolcs suggested?? > > > > > > > you can use > > > > .file "foo.s" > > One question -- will the fact that the line numbers don't match up > interfere with debugging? If so, the CFI generation should add the > directives to existing lines separated by ;'s rather than inserting > lines. > yes, i think the line numbers would be wrong then the ; idea fixes it, but then .cfi should be in prefix position (because of comments) > > > diff --git a/Makefile b/Makefile > > > index 6559295..9aefd62 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -118,7 +118,7 @@ $(foreach s,$(wildcard src/*/$(ARCH)*/*.s),$(eval $(call mkasmdep,$(s)))) > > > $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$(shell cat $<) > > > > > > %.o: $(ARCH)/%.s > > > - $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $< > > > + tools/aswrap.sh $< $@ $(ARCH) "$(CC) $(CFLAGS_ALL_STATIC)" > > > > > > > i think passing down the build command that way is not ok > > The quoting is probably off, but otherwise it doesn't look so bad. > > > " may be used inside CFLAGS (and there are other shell quote issues) > > it hides the build command in the make output > > it's not clear if the build correctly handles if CC fails > > Do you have a better design in mind? > i guess it could be tools/aswrap.sh $< $@ $(ARCH) -- $(CC) $(CFLAGS_ALL_STATIC) but it will be harder to follow what's going on in case of a failure than currently > > this does not handle binary (0b11) and octal (0123) asm consts > > (i think you should check for those and emit a warning). > > Is 0b something that could even be relied upon? We generally use a > minimal asm dialect without extensions that real or hypothetical > alternate assemblers might not have. I'm happy with a YAGNI approach > to the CFI generation. > ok > > i think > > > > pushl $123 > > push $123 > > > > are different > > How so? Likewise I don't think the stuff for 2-byte push/pop is > terribly useful. It's not a meaningful operation to be performing in > 32-bit code. > ok, they are the same