Patchwork [#2] stop using linux-unwind.h on GNU targets with kernels other than Linux

login
register
mail settings
Submitter Robert Millan
Date Jan. 19, 2011, 2:37 p.m.
Message ID <AANLkTinbMna+26WL9+2xi-0FaU0hvOa8spAnq_aJRngP@mail.gmail.com>
Download mbox | patch
Permalink /patch/79474/
State New
Headers show

Comments

Robert Millan - Jan. 19, 2011, 2:37 p.m.
2011/1/14 Robert Millan <rmh@gnu.org>:
> Confirmed, linux-unwind.h can be removed.
> 2011/1/12 Joseph S. Myers <joseph@codesourcery.com>:
>> If disabled for non-Linux-kernel targets, the
>> REG_NAME abstraction may as well be removed as not actually being useful
>> at present.
>
> Ack.  I'll send a patch for this.

Here is it, relative to my AMD64 patch.  ChangeLog in patch header.

Patch

2011-01-19  Robert Millan  <rmh@gnu.org>

	* config/i386/linux.h (REG_NAME): Remove.
	* config/i386/linux64.h: Likewise.
	* config/i386/kfreebsd-gnu.h: Likewise.
	* config/i386/knetbsd-gnu.h: Likewise.

	* config/i386/linux-unwind.h (x86_fallback_frame_state): Remove
	all use of REG_NAME (on GNU/Linux it's a no-op).

	* config/i386/kfreebsd-gnu.h (MD_UNWIND_SUPPORT): Undefine.
	* config/i386/knetbsd-gnu.h: Likewise.

=== modified file 'gcc/config/i386/kfreebsd-gnu.h'
--- gcc/config/i386/kfreebsd-gnu.h	2011-01-18 22:00:14 +0000
+++ gcc/config/i386/kfreebsd-gnu.h	2011-01-18 22:34:17 +0000
@@ -29,5 +29,4 @@  along with GCC; see the file COPYING3.
 #define GLIBC_DYNAMIC_LINKER64 "/lib/ld-kfreebsd-x86-64.so.1"
 #endif
 
-#undef REG_NAME
-#define REG_NAME(reg) sc_ ## reg
+#undef MD_UNWIND_SUPPORT

=== modified file 'gcc/config/i386/knetbsd-gnu.h'
--- gcc/config/i386/knetbsd-gnu.h	2011-01-18 22:00:14 +0000
+++ gcc/config/i386/knetbsd-gnu.h	2011-01-18 22:34:36 +0000
@@ -19,5 +19,4 @@  You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#undef REG_NAME
-#define REG_NAME(reg) sc_ ## reg
+#undef MD_UNWIND_SUPPORT

=== modified file 'gcc/config/i386/linux-unwind.h'
--- gcc/config/i386/linux-unwind.h	2011-01-18 22:00:14 +0000
+++ gcc/config/i386/linux-unwind.h	2011-01-19 14:27:25 +0000
@@ -146,28 +146,28 @@  x86_fallback_frame_state (struct _Unwind
   else
     return _URC_END_OF_STACK;
 
-  new_cfa = sc->REG_NAME(esp);
+  new_cfa = sc->esp;
   fs->regs.cfa_how = CFA_REG_OFFSET;
   fs->regs.cfa_reg = 4;
   fs->regs.cfa_offset = new_cfa - (long) context->cfa;
 
   /* The SVR4 register numbering macros aren't usable in libgcc.  */
   fs->regs.reg[0].how = REG_SAVED_OFFSET;
-  fs->regs.reg[0].loc.offset = (long)&sc->REG_NAME(eax) - new_cfa;
+  fs->regs.reg[0].loc.offset = (long)&sc->eax - new_cfa;
   fs->regs.reg[3].how = REG_SAVED_OFFSET;
-  fs->regs.reg[3].loc.offset = (long)&sc->REG_NAME(ebx) - new_cfa;
+  fs->regs.reg[3].loc.offset = (long)&sc->ebx - new_cfa;
   fs->regs.reg[1].how = REG_SAVED_OFFSET;
-  fs->regs.reg[1].loc.offset = (long)&sc->REG_NAME(ecx) - new_cfa;
+  fs->regs.reg[1].loc.offset = (long)&sc->ecx - new_cfa;
   fs->regs.reg[2].how = REG_SAVED_OFFSET;
-  fs->regs.reg[2].loc.offset = (long)&sc->REG_NAME(edx) - new_cfa;
+  fs->regs.reg[2].loc.offset = (long)&sc->edx - new_cfa;
   fs->regs.reg[6].how = REG_SAVED_OFFSET;
-  fs->regs.reg[6].loc.offset = (long)&sc->REG_NAME(esi) - new_cfa;
+  fs->regs.reg[6].loc.offset = (long)&sc->esi - new_cfa;
   fs->regs.reg[7].how = REG_SAVED_OFFSET;
-  fs->regs.reg[7].loc.offset = (long)&sc->REG_NAME(edi) - new_cfa;
+  fs->regs.reg[7].loc.offset = (long)&sc->edi - new_cfa;
   fs->regs.reg[5].how = REG_SAVED_OFFSET;
-  fs->regs.reg[5].loc.offset = (long)&sc->REG_NAME(ebp) - new_cfa;
+  fs->regs.reg[5].loc.offset = (long)&sc->ebp - new_cfa;
   fs->regs.reg[8].how = REG_SAVED_OFFSET;
-  fs->regs.reg[8].loc.offset = (long)&sc->REG_NAME(eip) - new_cfa;
+  fs->regs.reg[8].loc.offset = (long)&sc->eip - new_cfa;
   fs->retaddr_column = 8;
   fs->signal_frame = 1;
   return _URC_NO_REASON;

=== modified file 'gcc/config/i386/linux.h'
--- gcc/config/i386/linux.h	2011-01-18 22:00:14 +0000
+++ gcc/config/i386/linux.h	2011-01-18 22:20:49 +0000
@@ -202,9 +202,6 @@  along with GCC; see the file COPYING3.
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-/* This macro may be overridden in i386/k*bsd-gnu.h.  */
-#define REG_NAME(reg) reg
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
 #define TARGET_THREAD_SSP_OFFSET	0x14

=== modified file 'gcc/config/i386/linux64.h'
--- gcc/config/i386/linux64.h	2011-01-18 22:00:14 +0000
+++ gcc/config/i386/linux64.h	2011-01-18 22:19:19 +0000
@@ -116,9 +116,6 @@  see the files COPYING3 and COPYING.RUNTI
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-/* This macro may be overridden in i386/k*bsd-gnu.h.  */
-#define REG_NAME(reg) reg
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* i386 glibc provides __stack_chk_guard in %gs:0x14,
    x86_64 glibc provides it in %fs:0x28.  */