This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug nptl/2419] broken .eh_frame for one argument syscalls.


------- Additional Comments From dwhedon at debian dot org  2006-03-05 23:55 -------
Created an attachment (id=903)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=903&action=view)
patch to fix this bug

The patch above is far enough removed from the final objects that the
correctness of the fix isn't obvious (to me anyway). To verify the fix I took
the output object and steped through the FDE instructions to create the CFI
table.	Then I checked that the CFI table corresponds to the subroutine in
question.

$ ar -x /usr/lib/nptl/libc.a close.o
$ readelf --debug-dump=frames close.o
The section .eh_frame contains:

00000000 00000010 00000000 CIE
  Version:		 1
  Augmentation: 	 ""
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 8

  DW_CFA_def_cfa: r4 ofs 4
  DW_CFA_offset: r8 at cfa-4
  DW_CFA_nop
  DW_CFA_nop

00000014 00000020 00000018 FDE cie=00000000 pc=00000000..00000050
  DW_CFA_advance_loc: 12 to 0000000c
  DW_CFA_register: r3 in r2
  DW_CFA_advance_loc: 13 to 00000019
  DW_CFA_restore: r3
  DW_CFA_advance_loc: 21 to 0000002e
  DW_CFA_register: r3 in r2
  DW_CFA_advance_loc: 13 to 0000003b
  DW_CFA_restore: r3
  DW_CFA_advance_loc: 1 to 0000003c
  DW_CFA_def_cfa_offset: 8
  DW_CFA_advance_loc: 8 to 00000044
  DW_CFA_def_cfa_offset: 4
  DW_CFA_nop
  DW_CFA_nop
$
In order to decode the above I looked at sections 6.4 and Appendix
5 of http://www.arm.com/pdfs/TIS-DWARF2.pdf.  The CFI table described
above is show below.  I also filled in what I believe to be the CFI to
x86 register mapping and the callee saved registers.

				 fp  fp 	 ra
		 eax ecx edx ebx esp ebp esi edi eip
Loc	 CFA	 r0  r1  r2  r3  r4  r5  r6  r7  r8
0	 r4+4	 u   u	 u   s	 u   s	 s   s	 cfa-4
c			     r2
19			     s
2e			     r2
3b			     s
3c	 r4+8
44	 r4+4

key:
  = (blank) same as last (look up in same column to find value)
s = same_value rule
u = undefined rule
rN = register(N) rule

$ objdump -j .text -D close.o

close.o:     file format elf32-i386

Disassembly of section .text:

00000000 <__libc_close>:
   0:	65 83 3d 0c 00 00 00	cmpl   $0x0,%gs:0xc
   7:	00
   8:	75 1b			jne    25 <__close_nocancel+0x1b>

0000000a <__close_nocancel>:
   a:	89 da			mov    %ebx,%edx
   c:	8b 5c 24 04		mov    0x4(%esp),%ebx
  10:	b8 06 00 00 00		mov    $0x6,%eax
  15:	cd 80			int    $0x80
  17:	89 d3			mov    %edx,%ebx
  19:	3d 01 f0 ff ff		cmp    $0xfffff001,%eax
  1e:	0f 83 fc ff ff ff	jae    20 <__close_nocancel+0x16>
  24:	c3			ret
  25:	e8 fc ff ff ff		call   26 <__close_nocancel+0x1c>
  2a:	89 c1			mov    %eax,%ecx
  2c:	89 da			mov    %ebx,%edx
  2e:	8b 5c 24 04		mov    0x4(%esp),%ebx
  32:	b8 06 00 00 00		mov    $0x6,%eax
  37:	cd 80			int    $0x80
  39:	89 d3			mov    %edx,%ebx
  3b:	50			push   %eax
  3c:	89 c8			mov    %ecx,%eax
  3e:	e8 fc ff ff ff		call   3f <__close_nocancel+0x35>
  43:	58			pop    %eax
  44:	3d 01 f0 ff ff		cmp    $0xfffff001,%eax
  49:	0f 83 fc ff ff ff	jae    4b <__close_nocancel+0x41>
  4f:	c3			ret


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2419

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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