|
Message-ID: <20150512225212.GX17573@brightrain.aerifal.cx> Date: Tue, 12 May 2015 18:52:13 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH] First prototype of script which adds CFI directives to x86 asm On Tue, May 12, 2015 at 11:28:44PM +0200, Alex Dowad wrote: > Some functions implemented in asm need to use EBP for purposes other than acting > as a frame pointer. (Notably, it is used for the 6th argument to syscalls with > 6 arguments.) Without frame pointers, GDB can only show backtraces if it gets > CFI information from a .debug_frame or .eh_frame ELF section. Thanks! Some quick initial review, without testing/reviewing script contents in detail: > Makefile | 4 ++ > tools/add-cfi.awk.i386 | 152 +++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 156 insertions(+) > create mode 100644 tools/add-cfi.awk.i386 > > diff --git a/Makefile b/Makefile > index 6559295..f7335aa 100644 > --- a/Makefile > +++ b/Makefile > @@ -118,7 +118,11 @@ $(foreach s,$(wildcard src/*/$(ARCH)*/*.s),$(eval $(call mkasmdep,$(s)))) > $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$(shell cat $<) > > %.o: $(ARCH)/%.s > +ifeq ($(ARCH),i386) > + awk -f tools/add-cfi.awk.i386 $< | $(CC) $(CFLAGS_ALL_STATIC) -x assembler -c -o $@ - > +else > $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $< > +endif Here I'd like to see the arch passed to the script, and the script acting as a nop for archs it doesn't support, rather than a conditional in the makefile. Also if we're using -x assembler and input from stdin, configure will need to check for these and fall back to no cfi generation if they don't work. Possibly these could be combined by using a tools/aswrap.sh with the piping (or temp file, which wouldn't need special compiler-driver support) logic in it and the logic for calling a different awk script per arch or none at all, if you prefer to keep them as separate awk scripts. 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.