Patchwork [libbacktrace] Fix bootstrap with gcc 4.4

login
register
mail settings
Submitter Rainer Orth
Date Sept. 19, 2012, 9:30 a.m.
Message ID <ydd627anyvg.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/184961/
State New
Headers show

Comments

Rainer Orth - Sept. 19, 2012, 9:30 a.m.
Ian Lance Taylor <iant@google.com> writes:

> On Tue, Sep 18, 2012 at 1:32 AM, Rainer Orth
> <ro@cebitec.uni-bielefeld.de> wrote:
>> The libbacktrace integration broke Solaris 10 and 11 bootstrap when
>> using gcc 4.4 (any version of gcc without __sync_* support actually):
>
> The patch is fine and should fix the problem, but GCC 4.4 does have

Indeed, thanks.

> __sync_* support.  Might be worth looking into why the test failed.

On i386-pc-solaris2.*, __sync_bool_compare_and_swap_4 is missing.
sparc-sun-solaris2.11 is fine, though.

>> Unfortunately, Solaris 10 (and certainly Solaris 9, too) bootstrap is still
>> broken:
>>
>> /vol/gcc/src/hg/trunk/local/libbacktrace/dwarf.c:652: error: implicit
>> declaration of function 'strnlen'
>> make[1]: *** [dwarf.lo] Error 1
>>
>> Both completely lack strnlen().  I haven't done anything about this yet.
>
> This should be fixed now.

The strnlen part is (i386-pc-solaris2.1[01] and sparc-sun-solaris2.11
bootstraps currently running the testsuite), but a new problem turned up
on i386-pc-solaris2.9, which lacks stdint.h.

The following patch fixes this for me (bootstrap currently into
stage2).  I've removed the <stdint.h> includes in btest.c and dwarf.c
since that's already covered by backtrace.h.

Ok for mainline if that passes?

Thanks.
	Rainer


2012-09-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (GCC_HEADER_STDINT): Invoke.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* backtrace.h: Include gstdint.h instead of <stdint.h>.
	* btest.c: Don't include <stdint.h>.
	* dwarf.c: Likewise.
Ian Taylor - Sept. 19, 2012, 1:42 p.m.
On Wed, Sep 19, 2012 at 2:30 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Ian Lance Taylor <iant@google.com> writes:
>
>> __sync_* support.  Might be worth looking into why the test failed.
>
> On i386-pc-solaris2.*, __sync_bool_compare_and_swap_4 is missing.
> sparc-sun-solaris2.11 is fine, though.

Ah, I see.  __sync_bool_compare_and_swap only exists if compiling for
486 or above.  I guess I'm not too worried about that.

> The following patch fixes this for me (bootstrap currently into
> stage2).  I've removed the <stdint.h> includes in btest.c and dwarf.c
> since that's already covered by backtrace.h.
>
> Ok for mainline if that passes?

I don't particularly want backtrace.h, a public header file, to depend
on gstdint.h, a file created at build time.  This would mean that
backtrace.h can not be easily installed (it's not installed right now,
but I don't want to rule that out in the future).  But I guess it's OK
to have that dependency on ancient systems.

I installed this slightly different patch instead.

Thanks.

Ian


2012-09-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
	    Ian Lance Taylor  <iant@google.com>

        * configure.ac (GCC_HEADER_STDINT): Invoke.
        * backtrace.h: If we can't find <stdint.h>, use "gstdint.h".
        * btest.c: Don't include <stdint.h>.
        * dwarf.c: Likewise.
        * configure, aclocal.m4, Makefile.in, config.h.in: Rebuild.

Patch

# HG changeset patch
# Parent cbf27345ec507da8167eb50de6c21124cfd778c4
Provide stdint.h if missing

diff --git a/libbacktrace/backtrace.h b/libbacktrace/backtrace.h
--- a/libbacktrace/backtrace.h
+++ b/libbacktrace/backtrace.h
@@ -34,7 +34,7 @@  POSSIBILITY OF SUCH DAMAGE.  */
 #define BACKTRACE_H
 
 #include <stddef.h>
-#include <stdint.h>
+#include "gstdint.h"
 #include <stdio.h>
 
 #ifdef __cplusplus
diff --git a/libbacktrace/btest.c b/libbacktrace/btest.c
--- a/libbacktrace/btest.c
+++ b/libbacktrace/btest.c
@@ -34,7 +34,6 @@  POSSIBILITY OF SUCH DAMAGE.  */
    libbacktrace library.  */
 
 #include <assert.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -168,6 +168,8 @@  if test "$backtrace_supported" = "yes"; 
 fi
 AC_SUBST(BACKTRACE_SUPPORTED)
 
+GCC_HEADER_STDINT(gstdint.h)
+
 AC_CHECK_HEADERS(sys/mman.h)
 if test "$ac_cv_header_sys_mman_h" = "no"; then
   have_mmap=no
diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c
--- a/libbacktrace/dwarf.c
+++ b/libbacktrace/dwarf.c
@@ -33,7 +33,6 @@  POSSIBILITY OF SUCH DAMAGE.  */
 #include "config.h"
 
 #include <errno.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>