Patchwork Always define USE_PT_GNU_EH_FRAME in crtstuff.c for glibc

login
register
mail settings
Submitter Joseph S. Myers
Date Aug. 18, 2012, 10:50 a.m.
Message ID <Pine.LNX.4.64.1208181049560.11800@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/178444/
State New
Headers show

Comments

Joseph S. Myers - Aug. 18, 2012, 10:50 a.m.
On Sat, 18 Aug 2012, Ian Lance Taylor wrote:

> Looking at the #if just before this one, it looks like you've omitted
> the checks for a version of glibc before 2.2.2.  Also I'm not sure how
> this will play out with uClibc: it seems like it might always turn on
> USE_PT_GNU_EH_FRAME, which might or might not be OK.
> 
> These would not be issues if you added && defined(inhibit_libc).  Did
> you consider that?

Here is a version with the extra defined(inhibit_libc) test.  It's
passed the same tests as before on arm-none-linux-gnueabi and
x86_64-unknown-linux-gnu.  OK to commit?

2012-08-18  Joseph Myers  <joseph@codesourcery.com>

	* crtstuff.c (USE_PT_GNU_EH_FRAME): Define for systems using glibc
	even if inhibit_libc.
Ian Taylor - Aug. 18, 2012, 5:21 p.m.
On Sat, Aug 18, 2012 at 3:50 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
>
> 2012-08-18  Joseph Myers  <joseph@codesourcery.com>
>
>         * crtstuff.c (USE_PT_GNU_EH_FRAME): Define for systems using glibc
>         even if inhibit_libc.

This is OK.

Thanks.

Ian

Patch

Index: libgcc/crtstuff.c
===================================================================
--- libgcc/crtstuff.c	(revision 190491)
+++ libgcc/crtstuff.c	(working copy)
@@ -1,7 +1,7 @@ 
 /* Specialized bits of code needed to support construction and
    destruction of file-scope objects in C++ code.
    Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-   2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
+   2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Ron Guilmette (rfg@monkeys.com).
 
@@ -113,6 +113,20 @@ 
 #  define USE_PT_GNU_EH_FRAME
 # endif
 #endif
+
+#if defined(OBJECT_FORMAT_ELF) \
+    && !defined(OBJECT_FORMAT_FLAT) \
+    && defined(HAVE_LD_EH_FRAME_HDR) \
+    && !defined(CRTSTUFFT_O) \
+    && defined(inhibit_libc) \
+    && (defined(__GLIBC__) || defined(__gnu_linux__) || defined(__GNU__))
+/* On systems using glibc, an inhibit_libc build of libgcc is only
+   part of a bootstrap process.  Build the same crt*.o as would be
+   built with headers present, so that it is not necessary to build
+   glibc more than once for the bootstrap to converge.  */
+# define USE_PT_GNU_EH_FRAME
+#endif
+
 #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
 # define USE_EH_FRAME_REGISTRY
 #endif