Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so Add support for PT_ARM_EXIDX and __gnu_Unw...



details:   https://anonhg.NetBSD.org/src/rev/66c4bdabf7d4
branches:  trunk
changeset: 786276:66c4bdabf7d4
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Apr 24 22:37:20 2013 +0000

description:
Add support for PT_ARM_EXIDX and __gnu_Unwind_Find_exidx for libgcc's support
of the ARM EHABI.

diffstat:

 libexec/ld.elf_so/Makefile              |   5 ++++-
 libexec/ld.elf_so/arch/arm/Makefile.inc |   6 +++---
 libexec/ld.elf_so/headers.c             |  10 ++++++++--
 libexec/ld.elf_so/rtld.h                |  18 +++++++++++++++++-
 libexec/ld.elf_so/symbol.c              |   7 +++++--
 5 files changed, 37 insertions(+), 9 deletions(-)

diffs (145 lines):

diff -r 68176b3eef1e -r 66c4bdabf7d4 libexec/ld.elf_so/Makefile
--- a/libexec/ld.elf_so/Makefile        Wed Apr 24 22:35:23 2013 +0000
+++ b/libexec/ld.elf_so/Makefile        Wed Apr 24 22:37:20 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.115 2013/04/05 20:16:40 christos Exp $
+#      $NetBSD: Makefile,v 1.116 2013/04/24 22:37:20 matt Exp $
 #
 # NOTE: when changing ld.so, ensure that ldd still compiles.
 #
@@ -91,6 +91,9 @@
 #CPPFLAGS+=    -DDEBUG
 #CPPFLAGS+=    -DRTLD_DEBUG
 #CPPFLAGS+=    -DRTLD_DEBUG_RELOC
+.if !empty(MACHINE_ARCH:Mearm*)
+CPPFLAGS+=     -I${NETBSDSRCDIR}/lib/libexecinfo
+.endif
 #DBG=          -g
 COPTS=         -O3 -fomit-frame-pointer
 
diff -r 68176b3eef1e -r 66c4bdabf7d4 libexec/ld.elf_so/arch/arm/Makefile.inc
--- a/libexec/ld.elf_so/arch/arm/Makefile.inc   Wed Apr 24 22:35:23 2013 +0000
+++ b/libexec/ld.elf_so/arch/arm/Makefile.inc   Wed Apr 24 22:37:20 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.15 2013/01/23 02:31:54 matt Exp $
+#      $NetBSD: Makefile.inc,v 1.16 2013/04/24 22:37:20 matt Exp $
 
 SRCS+=         rtld_start.S mdreloc.c
 
@@ -6,9 +6,9 @@
 CPPFLAGS+=     -fpic
 
 CPPFLAGS+=     -DELFSIZE=32
-.if ${MACHINE_ARCH} == "earm" || ${MACHINE_ARCH} == "earmeb" \
-    || (!empty(CPUFLAGS) && ${CPUFLAGS:M-mabi=aapcs*} != "")
+.if !empty(MACHINE_ARCH:Mearm*)
 CPPFLAGS+=     -DHAVE_INITFINI_ARRAY
+SRCS+=         find_exidx.c
 .endif
 
 LDFLAGS+=      -Wl,-e,_rtld_start
diff -r 68176b3eef1e -r 66c4bdabf7d4 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c       Wed Apr 24 22:35:23 2013 +0000
+++ b/libexec/ld.elf_so/headers.c       Wed Apr 24 22:37:20 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: headers.c,v 1.43 2012/08/15 03:46:06 matt Exp $         */
+/*     $NetBSD: headers.c,v 1.44 2013/04/24 22:37:20 matt Exp $         */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.43 2012/08/15 03:46:06 matt Exp $");
+__RCSID("$NetBSD: headers.c,v 1.44 2013/04/24 22:37:20 matt Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -414,6 +414,12 @@
                        obj->tlsinit = (void *)(uintptr_t)ph->p_vaddr;
                        break;
 #endif
+#ifdef __ARM_EABI__
+               case PT_ARM_EXIDX:
+                       obj->exidx_start = (void *)(uintptr_t)vaddr;
+                       obj->exidx_sz = ph->p_memsz;
+                       break;
+#endif
                }
        }
        assert(nsegs == 2);
diff -r 68176b3eef1e -r 66c4bdabf7d4 libexec/ld.elf_so/rtld.h
--- a/libexec/ld.elf_so/rtld.h  Wed Apr 24 22:35:23 2013 +0000
+++ b/libexec/ld.elf_so/rtld.h  Wed Apr 24 22:37:20 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.h,v 1.110 2012/08/15 03:46:06 matt Exp $   */
+/*     $NetBSD: rtld.h,v 1.111 2013/04/24 22:37:20 matt Exp $   */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -46,6 +46,10 @@
 #include "rtldenv.h"
 #include "link.h"
 
+#ifdef __ARM_EABI__
+#include "unwind.h"
+#endif
+
 #if defined(_RTLD_SOURCE)
 
 #ifndef        RTLD_DEFAULT_LIBRARY_PATH
@@ -284,6 +288,10 @@
        size_t          init_arraysz;   /* # of entries in it */
        fptr_t          *fini_array;    /* start of fini array */
        size_t          fini_arraysz;   /* # of entries in it */
+#ifdef __ARM_EABI__
+       _Unwind_Ptr     exidx_start;
+       size_t          exidx_sz;
+#endif
 } Obj_Entry;
 
 typedef struct Struct_DoneList {
@@ -340,6 +348,14 @@
 
 __dso_public void *_dlauxinfo(void) __pure;
 
+#ifdef __ARM_EABI__
+/*
+ * This is used by libgcc to find the start and length of the exception table
+ * associated with a PC.
+ */
+__dso_public _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr, int *);
+#endif
+
 /* These aren't exported */
 void _rtld_error(const char *, ...)
      __attribute__((__format__(__printf__,1,2)));
diff -r 68176b3eef1e -r 66c4bdabf7d4 libexec/ld.elf_so/symbol.c
--- a/libexec/ld.elf_so/symbol.c        Wed Apr 24 22:35:23 2013 +0000
+++ b/libexec/ld.elf_so/symbol.c        Wed Apr 24 22:37:20 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: symbol.c,v 1.61 2012/08/15 03:46:07 matt Exp $  */
+/*     $NetBSD: symbol.c,v 1.62 2013/04/24 22:37:20 matt Exp $  */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: symbol.c,v 1.61 2012/08/15 03:46:07 matt Exp $");
+__RCSID("$NetBSD: symbol.c,v 1.62 2013/04/24 22:37:20 matt Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -101,6 +101,9 @@
                (fptr_t)___tls_get_addr,
 #endif
 #endif
+#ifdef __ARM_EABI__
+               (fptr_t)__gnu_Unwind_Find_exidx,        /* for gcc EHABI */
+#endif
                NULL
        };
        int i;



Home | Main Index | Thread Index | Old Index