This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Interpreter/libffi ARM Porting


Craig A. Vanderborgh writes:
  > 
 > What does this do?  Is it related to exception handling in some way?  Do
 > we need to have the equivalent thing in our ARM implementation?

It's the DWARF2 unwinder data.
Yes.
Yes.

You just need to tell the unwinder how to unwind through ffi_call_SYSV.

See http://www.eagercon.com/dwarf/dwarf-2.0.0.pdf, page 62.

I suggest you compile a simple function with -fPIC -dA and have a look at
the unwinder data.  On x86, It will look like this:

int main (int argc, char **argv)
{
  printf ("Hello, World!\n");
  return 0;
}


		.file	"hello.c"
		.section	.rodata.str1.1,"aMS",@progbits,1
	.LC0:
		.string	"Hello, World!"
		.text
		.align 4
	.globl main
		.type	main, @function
	main:
	.LFB12:
		# basic block 0
		pushl	%ebp
	.LCFI0:
		movl	%esp, %ebp
	.LCFI1:
		pushl	%ebx
	.LCFI2:
		subl	$4, %esp
	.LCFI3:
		call	__i686.get_pc_thunk.bx
		addl	$_GLOBAL_OFFSET_TABLE_, %ebx
		andl	$-16, %esp
		subl	$16, %esp
		leal	.LC0@GOTOFF(%ebx), %eax
		movl	%eax, (%esp)
		call	puts@PLT
		movl	$0, %eax
		movl	-4(%ebp), %ebx
		leave
		ret
	.LFE12:
		.size	main, .-main
	#APP

Copy this part:

		.section	.eh_frame,"a",@progbits
	.Lframe1:
		.long	.LECIE1-.LSCIE1	# Length of Common Information Entry
	.LSCIE1:
		.long	0x0	# CIE Identifier Tag
		.byte	0x1	# CIE Version
		.ascii "zR\0"	# CIE Augmentation
		.uleb128 0x1	# CIE Code Alignment Factor
		.sleb128 -4	# CIE Data Alignment Factor
		.byte	0x8	# CIE RA Column
		.uleb128 0x1	# Augmentation size
		.byte	0x1b	# FDE Encoding (pcrel sdata4)
		.byte	0xc	# DW_CFA_def_cfa
		.uleb128 0x4
		.uleb128 0x4
		.byte	0x88	# DW_CFA_offset, column 0x8
		.uleb128 0x1
		.align 4
	.LECIE1:

This is the part you need to tweak:

	.LSFDE1:
		.long	.LEFDE1-.LASFDE1	# FDE Length
	.LASFDE1:
		.long	.LASFDE1-.Lframe1	# FDE CIE offset
		.long	.LFB12-.	# FDE initial location
		.long	.LFE12-.LFB12	# FDE address range
		.uleb128 0x0	# Augmentation size

Advance PC to LCFI0:

		.byte	0x4	# DW_CFA_advance_loc4
		.long	.LCFI0-.LFB12

Call Frame Address is same as previous CFA, but at offset 8:

		.byte	0xe	# DW_CFA_def_cfa_offset
		.uleb128 0x8

Call Frame Address is at r5 + offset 8:

		.byte	0x85	# DW_CFA_offset, column 0x5
		.uleb128 0x2

Advance PC to LCFI1:

		.byte	0x4	# DW_CFA_advance_loc4
		.long	.LCFI1-.LCFI0

Call Frame Address is in r5, same offset as before:

		.byte	0xd	# DW_CFA_def_cfa_register
		.uleb128 0x5

Advance PC to LCFI3:

		.byte	0x4	# DW_CFA_advance_loc4
		.long	.LCFI3-.LCFI1

Call Frame Address is in r3 + offset 12:

		.byte	0x83	# DW_CFA_offset, column 0x3
		.uleb128 0x3
		.align 4
	.LEFDE1:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]