public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Indicate dependency on personality routines for ARM EHABI - take 2
@ 2005-03-03 22:43 Julian Brown
  2005-03-03 23:31 ` Paul Brook
  0 siblings, 1 reply; 11+ messages in thread
From: Julian Brown @ 2005-03-03 22:43 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

Hi,

This is a second attempt at a patch to make gas emit dependencies on 
exception-handling personality routines (__aeabi_unwind_cpp_pr[012]) in 
accordance with the ARM EHABI, using relocations of type R_ARM_NONE.

The previous patch is here:

   http://sourceware.org/ml/binutils/2005-02/msg00172.html

This version fixes some missing cases in the previous patch (eg, where 
there is a .personalityindex directive in an assembly source file but 
nothing is written to an .extab section), and outputs only one 
relocation for each personality routine per-file to save unnecessary bloat.

I'm not sure if the way this is implemented is good enough though: a 
global variable is initialised at load-time to indicate that no PR 
dependencies have been output yet. Are there any situations where gas 
processes more than one file consecutively, or is there any other reason 
why this might break?

Tested with no regressions with cross to arm-none-eabi, and natively on 
i686-pc-linux-gnu with all targets enabled.

OK to apply?

ChangeLog:

     * gas/config/tc-arm.c (marked_pr_dependency): New static global
     (bitmask).
     (create_unwind_entry): Don't output dependencies on PR routines
     here.
     (s_arm_unwind_fnend): Output dependency on unwinding routines, if it
     hasn't been done already.
     * gas/testsuite/arm/unwind.d: Update expected output.

-- 
Julian Brown
CodeSourcery, LLC

[-- Attachment #2: patch-10 --]
[-- Type: text/plain, Size: 4754 bytes --]

? bfd/doc/bfd.info
? bfd/doc/bfd.info-1
? gas/doc/as.info
? gas/doc/as.info-1
? gprof/gprof.info
? gprof/gprof.info-1
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.193
diff -c -p -r1.193 tc-arm.c
*** gas/config/tc-arm.c	23 Feb 2005 12:28:03 -0000	1.193
--- gas/config/tc-arm.c	3 Mar 2005 22:18:25 -0000
*************** static struct
*** 83,88 ****
--- 83,93 ----
    unsigned        sp_restored:1;
  } unwind;
  
+ /* Bit N indicates that an R_ARM_NONE relocation has been output for
+    __aeabi_unwind_cpp_prN already if set. This enables dependencies to be
+    emitted only once per file, to save unnecessary bloat.  */
+ static unsigned int marked_pr_dependency = 0;
+ 
  #endif /* OBJ_ELF */
  
  enum arm_float_abi
*************** create_unwind_entry (int have_data)
*** 13902,13914 ****
        fix_new (frag_now, where, 4, unwind.personality_routine, 0, 1,
  	       BFD_RELOC_ARM_PREL31);
  
-       /* Indicate dependency to linker.  */
-         {
-           char *name = "__aeabi_unwind_cpp_pr0";
- 	  symbolS *pr = symbol_find_or_make (name);
- 	  fix_new (frag_now, where, 4, pr, 0, 1, BFD_RELOC_NONE);
- 	}
- 
        where += 4;
        ptr += 4;
  
--- 13907,13912 ----
*************** create_unwind_entry (int have_data)
*** 13922,13945 ****
        /* Three opcodes bytes are packed into the first word.  */
        data = 0x80;
        n = 3;
!       goto emit_reloc;
  
      case 1:
      case 2:
        /* The size and first two opcode bytes go in the first word.  */
        data = ((0x80 + unwind.personality_index) << 8) | size;
        n = 2;
-       goto emit_reloc;
- 
-     emit_reloc:
-       {
- 	/* Indicate dependency to linker.  */
- 	char *name[] = { "__aeabi_unwind_cpp_pr0",
- 	                 "__aeabi_unwind_cpp_pr1",
- 			 "__aeabi_unwind_cpp_pr2" };
- 	symbolS *pr = symbol_find_or_make (name[unwind.personality_index]);
- 	fix_new (frag_now, where, 4, pr, 0, 1, BFD_RELOC_NONE);
-       }
        break;
  
      default:
--- 13920,13932 ----
        /* Three opcodes bytes are packed into the first word.  */
        data = 0x80;
        n = 3;
!       break;
  
      case 1:
      case 2:
        /* The size and first two opcode bytes go in the first word.  */
        data = ((0x80 + unwind.personality_index) << 8) | size;
        n = 2;
        break;
  
      default:
*************** s_arm_unwind_fnend (int ignored ATTRIBUT
*** 14048,14053 ****
--- 14035,14055 ----
    fix_new (frag_now, where, 4, unwind.proc_start, 0, 1,
  	   BFD_RELOC_ARM_PREL31);
  
+   /* Indicate dependency on EHABI-defined personality routines to the 
+      linker, if it hasn't been done already.  */
+   if (unwind.personality_index >= 0 && unwind.personality_index < 3)
+     {
+       char *name[] = { "__aeabi_unwind_cpp_pr0",
+ 		       "__aeabi_unwind_cpp_pr1",
+ 		       "__aeabi_unwind_cpp_pr2" };
+       if (!(marked_pr_dependency & (1 << unwind.personality_index)))
+ 	{
+ 	  symbolS *pr = symbol_find_or_make (name[unwind.personality_index]);
+ 	  fix_new (frag_now, where, 0, pr, 0, 1, BFD_RELOC_NONE);
+ 	  marked_pr_dependency |= 1 << unwind.personality_index;
+ 	}
+     }
+ 
    if (val)
      /* Inline exception table entry.  */
      md_number_to_chars (ptr + 4, val, 4);
Index: gas/testsuite/gas/arm/unwind.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/unwind.d,v
retrieving revision 1.4
diff -c -p -r1.4 unwind.d
*** gas/testsuite/gas/arm/unwind.d	10 Feb 2005 12:39:17 -0000	1.4
--- gas/testsuite/gas/arm/unwind.d	3 Mar 2005 22:18:30 -0000
***************
*** 5,20 ****
  
  RELOCATION RECORDS FOR \[.ARM.extab\]:
  OFFSET   TYPE              VALUE 
- 00000000 R_ARM_NONE        __aeabi_unwind_cpp_pr1
  0000000c R_ARM_PREL31      .text
- 0000000c R_ARM_NONE        __aeabi_unwind_cpp_pr0
- 0000001c R_ARM_NONE        __aeabi_unwind_cpp_pr1
  
  
  RELOCATION RECORDS FOR \[.ARM.exidx\]:
  OFFSET   TYPE              VALUE 
  00000000 R_ARM_PREL31      .text
  00000008 R_ARM_PREL31      .text
  0000000c R_ARM_PREL31      .ARM.extab
  00000010 R_ARM_PREL31      .text
  00000014 R_ARM_PREL31      .ARM.extab
--- 5,19 ----
  
  RELOCATION RECORDS FOR \[.ARM.extab\]:
  OFFSET   TYPE              VALUE 
  0000000c R_ARM_PREL31      .text
  
  
  RELOCATION RECORDS FOR \[.ARM.exidx\]:
  OFFSET   TYPE              VALUE 
  00000000 R_ARM_PREL31      .text
+ 00000000 R_ARM_NONE        __aeabi_unwind_cpp_pr0
  00000008 R_ARM_PREL31      .text
+ 00000008 R_ARM_NONE        __aeabi_unwind_cpp_pr1
  0000000c R_ARM_PREL31      .ARM.extab
  00000010 R_ARM_PREL31      .text
  00000014 R_ARM_PREL31      .ARM.extab

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-03-29 16:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-03 22:43 [PATCH] Indicate dependency on personality routines for ARM EHABI - take 2 Julian Brown
2005-03-03 23:31 ` Paul Brook
2005-03-07 15:36   ` Julian Brown
2005-03-07 16:08     ` Paul Brook
2005-03-07 18:40       ` Julian Brown
2005-03-09 12:57         ` Nick Clifton
2005-03-09 15:13           ` Richard Earnshaw
2005-03-09 15:26         ` Richard Earnshaw
2005-03-29  6:42           ` [PATCH] Indicate dependency on personality routines for ARM EHABI - take 3 Julian Brown
2005-03-29 17:38             ` Richard Earnshaw
2005-03-29 20:00               ` Julian Brown

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 read-only IMAP folder(s) and NNTP newsgroup(s).