This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

fde alignment


I've been noticing

cleanup-10.exe(5439): unaligned trap at 0000000120005234: 00000200002344aa 28 16
cleanup-10.exe(5439): unaligned trap at 00000001200020b8: 00000200002344aa 28 1
cleanup-10.exe(5439): unaligned trap at 00000001200021e0: 000002000023440f 28 17
cleanup-10.exe(5439): unaligned trap at 0000000120002298: 00000200002344a6 28 17

Turns out that gcc does in fact expect the fde and cie headers to 
be aligned.  Fixed like so.


r~


        * dw2gencfi.c (output_cie): Align length to 4 byte boundary.
        (cfi_finish): Likewise for fde.

        * gas/alpha/elf-reloc-8.d, gas/cfi/cfi-alpha-1.d,
        gas/cfi/cfi-alpha-2.d, gas/cfi/cfi-alpha-3.d, gas/cfi/cfi-common-1.d,
        gas/cfi/cfi-common-2.d, gas/cfi/cfi-common-3.d: Adjust offsets.

Index: dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.15
diff -c -p -d -u -r1.15 dw2gencfi.c
--- dw2gencfi.c	29 Aug 2003 20:32:55 -0000	1.15
+++ dw2gencfi.c	7 Mar 2004 08:43:25 -0000
@@ -857,6 +857,7 @@ output_cie (struct cie_entry *cie)
     for (i = cie->first; i != cie->last; i = i->next)
       output_cfi_insn (i);
 
+  frag_align (2, 0, 0);
   symbol_set_value_now (end_address);
 }
 
@@ -906,8 +907,7 @@ output_fde (struct fde_entry *fde, struc
   for (; first; first = first->next)
     output_cfi_insn (first);
 
-  if (align)
-    frag_align (align, 0, 0);
+  frag_align (align, 0, 0);
   symbol_set_value_now (end_address);
 }
 
@@ -1035,7 +1035,7 @@ cfi_finish (void)
       struct cie_entry *cie;
 
       cie = select_cie_for_fde (fde, &first);
-      output_fde (fde, cie, first, fde->next == NULL ? EH_FRAME_ALIGNMENT : 0);
+      output_fde (fde, cie, first, fde->next == NULL ? EH_FRAME_ALIGNMENT : 2);
     }
 
   flag_traditional_format = save_flag_traditional_format;
Index: testsuite/gas/alpha/elf-reloc-8.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/alpha/elf-reloc-8.d,v
retrieving revision 1.5
diff -c -p -d -u -r1.5 elf-reloc-8.d
--- testsuite/gas/alpha/elf-reloc-8.d	17 Oct 2003 01:36:56 -0000	1.5
+++ testsuite/gas/alpha/elf-reloc-8.d	7 Mar 2004 08:43:25 -0000
@@ -311,20 +311,20 @@ OFFSET *TYPE *VALUE 
 
 RELOCATION RECORDS FOR \[\.eh_frame\]:
 OFFSET *TYPE *VALUE 
-0*000001b SREL32            \.init\.text
-0*0000031 SREL32            \.init\.text\+0x0*0000050
-0*0000042 SREL32            \.init\.text\+0x0*0000080
-0*0000053 SREL32            \.init\.text\+0x0*00000b0
-0*0000074 SREL32            \.init\.text\+0x0*00002c0
-0*0000092 SREL32            \.init\.text\+0x0*00005a0
-0*00000aa SREL32            \.init\.text\+0x0*00005f0
-0*00000bb SREL32            \.init\.text\+0x0*0000610
-0*00000cc SREL32            \.init\.text\+0x0*0000630
-0*00000e6 SREL32            \.init\.text\+0x0*0000750
-0*000010a SREL32            \.init\.text\+0x0*0000990
-0*0000124 SREL32            \.init\.text\+0x0*0000a10
-0*0000135 SREL32            \.init\.text\+0x0*0000a20
-0*0000146 SREL32            \.init\.text\+0x0*0000a40
-0*000015e SREL32            \.init\.text\+0x0*0000a90
-0*000016f SREL32            \.init\.text\+0x0*0000aa0
-0*0000180 SREL32            \.text
+0*000001c SREL32            \.init\.text
+0*0000034 SREL32            \.init\.text\+0x0*0000050
+0*0000048 SREL32            \.init\.text\+0x0*0000080
+0*000005c SREL32            \.init\.text\+0x0*00000b0
+0*0000080 SREL32            \.init\.text\+0x0*00002c0
+0*00000a0 SREL32            \.init\.text\+0x0*00005a0
+0*00000b8 SREL32            \.init\.text\+0x0*00005f0
+0*00000cc SREL32            \.init\.text\+0x0*0000610
+0*00000e0 SREL32            \.init\.text\+0x0*0000630
+0*00000fc SREL32            \.init\.text\+0x0*0000750
+0*0000120 SREL32            \.init\.text\+0x0*0000990
+0*000013c SREL32            \.init\.text\+0x0*0000a10
+0*0000150 SREL32            \.init\.text\+0x0*0000a20
+0*0000164 SREL32            \.init\.text\+0x0*0000a40
+0*000017c SREL32            \.init\.text\+0x0*0000a90
+0*0000190 SREL32            \.init\.text\+0x0*0000aa0
+0*00001a4 SREL32            \.text
Index: testsuite/gas/cfi/cfi-alpha-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-alpha-1.d,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cfi-alpha-1.d
--- testsuite/gas/cfi/cfi-alpha-1.d	18 Jun 2003 17:58:48 -0000	1.2
+++ testsuite/gas/cfi/cfi-alpha-1.d	7 Mar 2004 08:43:25 -0000
@@ -2,7 +2,7 @@
 #name: CFI on alpha
 The section .eh_frame contains:
 
-00000000 0000000f 00000000 CIE
+00000000 00000010 00000000 CIE
   Version:               1
   Augmentation:          "zR"
   Code alignment factor: 4
@@ -11,12 +11,19 @@ The section .eh_frame contains:
   Augmentation data:     1b
 
   DW_CFA_def_cfa_reg: r30
+  DW_CFA_nop
 
-00000013 00000019 00000017 FDE cie=00000000 pc=0000001b..0000004f
-  DW_CFA_advance_loc: 24 to 00000033
+00000014 00000020 00000018 FDE cie=00000000 pc=0000001c..00000050
+  DW_CFA_advance_loc: 24 to 00000034
   DW_CFA_def_cfa: r15 ofs 32
   DW_CFA_offset: r26 at cfa-32
   DW_CFA_offset: r9 at cfa-24
   DW_CFA_offset: r15 at cfa-16
   DW_CFA_offset: r34 at cfa-8
-
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
Index: testsuite/gas/cfi/cfi-alpha-2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-alpha-2.d,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cfi-alpha-2.d
--- testsuite/gas/cfi/cfi-alpha-2.d	18 Jun 2003 17:58:48 -0000	1.2
+++ testsuite/gas/cfi/cfi-alpha-2.d	7 Mar 2004 08:43:25 -0000
@@ -5,5 +5,5 @@
 
 RELOCATION RECORDS FOR \[\.eh_frame\]:
 OFFSET           TYPE              VALUE 
-0*000001b SREL32            \.text
-0*000002c SREL32            \.text\+0x0*0000004
+0*000001c SREL32            \.text
+0*0000030 SREL32            \.text\+0x0*0000004
Index: testsuite/gas/cfi/cfi-alpha-3.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-alpha-3.d,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cfi-alpha-3.d
--- testsuite/gas/cfi/cfi-alpha-3.d	18 Jun 2003 17:58:48 -0000	1.2
+++ testsuite/gas/cfi/cfi-alpha-3.d	7 Mar 2004 08:43:25 -0000
@@ -2,7 +2,7 @@
 #name: CFI on alpha, 3
 The section .eh_frame contains:
 
-00000000 0000000f 00000000 CIE
+00000000 00000010 00000000 CIE
   Version:               1
   Augmentation:          "zR"
   Code alignment factor: 4
@@ -11,23 +11,23 @@ The section .eh_frame contains:
   Augmentation data:     1b
 
   DW_CFA_def_cfa_reg: r30
+  DW_CFA_nop
 
-00000013 00000029 00000017 FDE cie=00000000 pc=0000001b..0000005b
-  DW_CFA_advance_loc: 4 to 0000001f
+00000014 00000028 00000018 FDE cie=00000000 pc=0000001c..0000005c
+  DW_CFA_advance_loc: 4 to 00000020
   DW_CFA_def_cfa_offset: 32
-  DW_CFA_advance_loc: 4 to 00000023
+  DW_CFA_advance_loc: 4 to 00000024
   DW_CFA_offset: r26 at cfa-32
-  DW_CFA_advance_loc: 4 to 00000027
+  DW_CFA_advance_loc: 4 to 00000028
   DW_CFA_offset: r9 at cfa-24
-  DW_CFA_advance_loc: 4 to 0000002b
+  DW_CFA_advance_loc: 4 to 0000002c
   DW_CFA_offset: r15 at cfa-16
-  DW_CFA_advance_loc: 4 to 0000002f
+  DW_CFA_advance_loc: 4 to 00000030
   DW_CFA_offset: r34 at cfa-8
-  DW_CFA_advance_loc: 4 to 00000033
+  DW_CFA_advance_loc: 4 to 00000034
   DW_CFA_def_cfa_reg: r15
-  DW_CFA_advance_loc: 36 to 00000057
+  DW_CFA_advance_loc: 36 to 00000058
   DW_CFA_def_cfa: r30 ofs 0
-  DW_CFA_nop
   DW_CFA_nop
   DW_CFA_nop
   DW_CFA_nop
Index: testsuite/gas/cfi/cfi-common-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-common-1.d,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cfi-common-1.d
--- testsuite/gas/cfi/cfi-common-1.d	18 Jun 2003 17:58:48 -0000	1.2
+++ testsuite/gas/cfi/cfi-common-1.d	7 Mar 2004 08:43:25 -0000
@@ -2,7 +2,7 @@
 #name: CFI common 1
 The section .eh_frame contains:
 
-00000000 0000000d 00000000 CIE
+00000000 00000010 00000000 CIE
   Version:               1
   Augmentation:          "zR"
   Code alignment factor: .*
@@ -10,14 +10,14 @@ The section .eh_frame contains:
   Return address column: .*
   Augmentation data:     1b
 
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
 
-00000011 0000001b 00000015 FDE cie=00000000 pc=.*
+00000014 00000018 00000018 FDE cie=00000000 pc=.*
   DW_CFA_advance_loc: 4 to .*
   DW_CFA_def_cfa: r0 ofs 16
   DW_CFA_offset: r1 at cfa-8
   DW_CFA_advance_loc: 4 to .*
   DW_CFA_def_cfa_offset: 32
   DW_CFA_offset: r2 at cfa-24
-  DW_CFA_nop
-  DW_CFA_nop
-  DW_CFA_nop
Index: testsuite/gas/cfi/cfi-common-2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-common-2.d,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cfi-common-2.d
--- testsuite/gas/cfi/cfi-common-2.d	18 Jun 2003 17:58:48 -0000	1.2
+++ testsuite/gas/cfi/cfi-common-2.d	7 Mar 2004 08:43:25 -0000
@@ -2,16 +2,15 @@
 #name: CFI common 2
 The section .eh_frame contains:
 
-00000000 0000000d 00000000 CIE
+00000000 00000010 00000000 CIE
   Version:               1
   Augmentation:          "zR"
   Code alignment factor: .*
   Data alignment factor: .*
   Return address column: .*
   Augmentation data:     1b
-
-
-00000011 0000001[bf] 00000015 FDE cie=00000000 pc=.*
+#...
+00000014 00000020 00000018 FDE cie=00000000 pc=.*
   DW_CFA_advance_loc: 4 to .*
   DW_CFA_def_cfa: r0 ofs 16
   DW_CFA_advance_loc: 4 to .*
@@ -22,5 +21,4 @@ The section .eh_frame contains:
   DW_CFA_restore_state
   DW_CFA_advance_loc: 4 to .*
   DW_CFA_def_cfa_offset: 0
-# 64-bit arches will have here 4 times DW_CFA_nop
-#...
+#pass
Index: testsuite/gas/cfi/cfi-common-3.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi-common-3.d,v
retrieving revision 1.2
diff -c -p -d -u -r1.2 cfi-common-3.d
--- testsuite/gas/cfi/cfi-common-3.d	18 Jun 2003 17:58:48 -0000	1.2
+++ testsuite/gas/cfi/cfi-common-3.d	7 Mar 2004 08:43:25 -0000
@@ -2,19 +2,16 @@
 #name: CFI common 3
 The section .eh_frame contains:
 
-00000000 0000000d 00000000 CIE
+00000000 00000010 00000000 CIE
   Version:               1
   Augmentation:          "zR"
   Code alignment factor: .*
   Data alignment factor: .*
   Return address column: .*
   Augmentation data:     1b
-
-
-00000011 00000013 00000015 FDE cie=00000000 pc=.*
+#...
+00000014 00000010 00000018 FDE cie=00000000 pc=.*
   DW_CFA_advance_loc: 4 to .*
   DW_CFA_remember_state
   DW_CFA_restore_state
-  DW_CFA_nop
-  DW_CFA_nop
-  DW_CFA_nop
+#pass


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