From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] First prototype of script which adds CFI directives to x86 asm
Date: Tue, 12 May 2015 18:52:13 -0400 [thread overview]
Message-ID: <20150512225212.GX17573@brightrain.aerifal.cx> (raw)
In-Reply-To: <1431466124-2848-1-git-send-email-alexinbeijing@gmail.com>
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
next prev parent reply other threads:[~2015-05-12 22:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 21:28 Alex Dowad
2015-05-12 22:52 ` Rich Felker [this message]
2015-05-13 11:39 ` Szabolcs Nagy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150512225212.GX17573@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).