public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Julian Brown <julian@codesourcery.com>
To: binutils@sources.redhat.com
Subject: [PATCH] Indicate dependency on personality routines for ARM EHABI
Date: Wed, 09 Feb 2005 17:06:00 -0000	[thread overview]
Message-ID: <420A38B6.3010609@codesourcery.com> (raw)

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

Hi,

This patch causes gas to emit dependencies on personality routines 
(__aeabi_unwind_cpp_pr[012]) from a suitable run-time library when 
necessary, using an R_ARM_NONE relocation type.

Tested on i686-pc-linux-gnu and arm-none-eabi with no regressions 
(though the expected output for the .ARM.extab has changed for one of 
the tests.)

OK to apply?

ChangeLog:

     * bfd/bfd-in2.h (bfd_reloc_code_real): New relocation type
     (BFD_RELOC_ARM_NONE).
     * bfd/elf32-arm.c (elf32_arm_reloc_map): BFD_RELOC_ARM_NONE maps to
     R_ARM_NONE.
     * bfd/libbfd.h (bfd_reloc_code_): Add BFD_RELOC_ARM_NONE.
     * bfd/reloc.c (BFD_RELOC_ARM_NONE): Add.
     * gas/config/tc-arm.c (md_apply_fix3): Handle BFD_RELOC_ARM_NONE.
     (tc_gen_reloc): Handle BFD_RELOC_ARM_NONE.
     (create_unwind_entry): Output dependency on the unwinding routines.
     * gas/testsuite/gas/arm/unwind.d: Alter expected output to include
     dependency on __aeabi_unwind_cpp_pr[01].

-- 
Julian Brown
CodeSourcery, LLC

[-- Attachment #2: patch-5 --]
[-- Type: text/plain, Size: 6932 bytes --]

? bfd/doc/bfd.info
? bfd/doc/bfd.info-1
? gas/doc/as.info
? gas/doc/as.info-1
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.318
diff -c -p -r1.318 bfd-in2.h
*** bfd/bfd-in2.h	28 Jan 2005 17:24:38 -0000	1.318
--- bfd/bfd-in2.h	9 Feb 2005 15:50:19 -0000
*************** field in the instruction.  */
*** 2642,2647 ****
--- 2642,2648 ----
  
  /* These relocs are only used within the ARM assembler.  They are not
  (at present) written to any object files.  */
+   BFD_RELOC_ARM_NONE,
    BFD_RELOC_ARM_IMMEDIATE,
    BFD_RELOC_ARM_ADRL_IMMEDIATE,
    BFD_RELOC_ARM_OFFSET_IMM,
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.20
diff -c -p -r1.20 elf32-arm.c
*** bfd/elf32-arm.c	31 Jan 2005 17:50:20 -0000	1.20
--- bfd/elf32-arm.c	9 Feb 2005 15:50:21 -0000
*************** static const struct elf32_arm_reloc_map 
*** 867,872 ****
--- 867,873 ----
      {BFD_RELOC_ARM_OFFSET_IMM,       R_ARM_ABS12},
      {BFD_RELOC_ARM_THUMB_OFFSET,     R_ARM_THM_ABS5},
      {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
+     {BFD_RELOC_ARM_NONE,             R_ARM_NONE},
      {BFD_RELOC_ARM_COPY,             R_ARM_COPY},
      {BFD_RELOC_ARM_GLOB_DAT,         R_ARM_GLOB_DAT},
      {BFD_RELOC_ARM_JUMP_SLOT,        R_ARM_JUMP_SLOT},
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.h,v
retrieving revision 1.134
diff -c -p -r1.134 libbfd.h
*** bfd/libbfd.h	25 Jan 2005 20:22:23 -0000	1.134
--- bfd/libbfd.h	9 Feb 2005 15:50:23 -0000
*************** static const char *const bfd_reloc_code_
*** 1125,1130 ****
--- 1125,1131 ----
    "BFD_RELOC_PPC64_DTPREL16_HIGHESTA",
    "BFD_RELOC_I370_D12",
    "BFD_RELOC_CTOR",
+   "BFD_RELOC_ARM_NONE",
    "BFD_RELOC_ARM_PCREL_BRANCH",
    "BFD_RELOC_ARM_PCREL_BLX",
    "BFD_RELOC_THUMB_PCREL_BLX",
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/src/src/bfd/reloc.c,v
retrieving revision 1.121
diff -c -p -r1.121 reloc.c
*** bfd/reloc.c	31 Jan 2005 23:13:29 -0000	1.121
--- bfd/reloc.c	9 Feb 2005 15:50:26 -0000
*************** ENUMDOC
*** 2564,2569 ****
--- 2564,2573 ----
    It generally does map to one of the other relocation types.
  
  ENUM
+   BFD_RELOC_ARM_NONE
+ ENUMDOC
+   For when we really want to write R_ARM_NONE to the object file.
+ ENUM
    BFD_RELOC_ARM_PCREL_BRANCH
  ENUMDOC
    ARM 26 bit pc-relative branch.  The lowest two bits must be zero and are
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.190
diff -c -p -r1.190 tc-arm.c
*** gas/config/tc-arm.c	31 Jan 2005 23:18:25 -0000	1.190
--- gas/config/tc-arm.c	9 Feb 2005 15:50:30 -0000
*************** md_apply_fix3 (fixS *   fixP,
*** 11383,11388 ****
--- 11383,11393 ----
  
    switch (fixP->fx_r_type)
      {
+     case BFD_RELOC_ARM_NONE:
+       /* This will need to go into the object file.  */
+       fixP->fx_done = 0;
+       break;
+   
      case BFD_RELOC_ARM_IMMEDIATE:
        /* We claim that this fixup has been processed here,
  	 even if in fact we generate an error because we do
*************** tc_gen_reloc (asection * section ATTRIBU
*** 12106,12111 ****
--- 12111,12117 ----
  	  break;
  	}
  
+     case BFD_RELOC_ARM_NONE:
      case BFD_RELOC_ARM_PCREL_BRANCH:
      case BFD_RELOC_ARM_PCREL_BLX:
      case BFD_RELOC_RVA:
*************** tc_gen_reloc (asection * section ATTRIBU
*** 12170,12175 ****
--- 12176,12182 ----
  
  	switch (fixp->fx_r_type)
  	  {
+ 	  case BFD_RELOC_ARM_NONE:         type = "ARM_NONE";     break;
  	  case BFD_RELOC_ARM_OFFSET_IMM8:  type = "OFFSET_IMM8";  break;
  	  case BFD_RELOC_ARM_SHIFT_IMM:    type = "SHIFT_IMM";    break;
  	  case BFD_RELOC_ARM_SMI:          type = "SMI";          break;
*************** create_unwind_entry (int have_data)
*** 13893,13898 ****
--- 13900,13913 ----
        /* Custom personality routine.  */
        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_ARM_NONE);
+ 	}
+ 
        where += 4;
        ptr += 4;
  
*************** create_unwind_entry (int have_data)
*** 13902,13919 ****
        break;
  
      /* ABI defined personality routines.  */
-     /* TODO: Emit R_ARM_NONE to the personality routine.  */
      case 0:
        /* 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:
--- 13917,13944 ----
        break;
  
      /* ABI defined personality routines.  */
      case 0:
        /* 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_ARM_NONE);
+       }
        break;
  
      default:
Index: gas/testsuite/gas/arm/unwind.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/unwind.d,v
retrieving revision 1.3
diff -c -p -r1.3 unwind.d
*** gas/testsuite/gas/arm/unwind.d	9 Dec 2004 20:25:24 -0000	1.3
--- gas/testsuite/gas/arm/unwind.d	9 Feb 2005 15:50:44 -0000
***************
*** 1,11 ****
  #objdump: -sr
  #name: Unwind table generation
  
! .*:     file format.*
  
  RELOCATION RECORDS FOR \[.ARM.extab\]:
  OFFSET   TYPE              VALUE 
  0000000c R_ARM_PREL31      .text
  
  
  RELOCATION RECORDS FOR \[.ARM.exidx\]:
--- 1,14 ----
  #objdump: -sr
  #name: Unwind table generation
  
! dump.o:     file format elf32-littlearm
  
  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\]:

             reply	other threads:[~2005-02-09 16:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-09 17:06 Julian Brown [this message]
2005-02-09 17:09 ` Ian Lance Taylor
2005-02-09 17:24   ` Paul Brook
2005-02-09 17:32     ` Ian Lance Taylor
2005-02-09 19:43     ` Andreas Schwab
2005-02-09 17:28   ` Richard Earnshaw
2005-02-09 17:42     ` Ian Lance Taylor
2005-02-09 18:26       ` Richard Earnshaw
2005-02-09 19:02   ` Julian Brown
2005-02-09 20:27     ` Ian Lance Taylor
2005-02-09 20:35     ` Richard Earnshaw
2005-02-09 21:48       ` Julian Brown
2005-02-09 22:21       ` Julian Brown
2005-02-10 14:07         ` Richard Earnshaw
2005-02-09 17:12 ` Richard Earnshaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=420A38B6.3010609@codesourcery.com \
    --to=julian@codesourcery.com \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).