[Fwd: Add DW_OP_GNU_encoded_addr]

Richard Henderson rth@redhat.com
Wed Sep 24 23:24:00 GMT 2008


Here's the gas/binutils part of the feature I just posted about
on the gcc list.


r~


-------- Original Message --------
Subject: Add DW_OP_GNU_encoded_addr
Date: Wed, 24 Sep 2008 16:14:18 -0700
From: Richard Henderson <rth@redhat.com>
To: gcc-patches@gcc.gnu.org

This is a new dwarf unwind expression opcode that allows an absolute
address to be put into the .eh_frame section without having to resort
to DW_OP_addr, which would result in runtime relocations in shared
libraries.

This opcode will be generated by a new gas .cfi_val_encoded_addr
directive.  This directive is intended to be used with inline assembly
which actually contains out-of-line code (i.e. in another section).
E.g.

    asm(	"test something
	jnz 1f
	.section text2,\"ax\"
1:	.cfi_startproc simple
	.cfi_def_cfa %%esp, 0
	.cfi_val_encoded_addr %%eip, 0x1b, 11f
	<do-some-stuff>
	jmp 11f
	.cfi_endproc
	.previous
11:");

This is an idiom that shows up several places in glibc and in the
kernel.  In glibc, Jakub currently goes to heroic efforts to
generate the unwind information by hand, but this code is what you
might call write-only i.e. intensely difficult to modify.


r~

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: zz.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20080924/0148dd71/attachment.txt>


More information about the Binutils mailing list