diff mbox

[libbacktrace] Fix bootstrap with gcc 4.4

Message ID yddpq5john5.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Sept. 18, 2012, 8:32 a.m. UTC
The libbacktrace integration broke Solaris 10 and 11 bootstrap when
using gcc 4.4 (any version of gcc without __sync_* support actually):

stage1 config.h has

/* #undef HAVE_SYNC_FUNCTIONS */

and fileline.c and mmap.c fail to compile:

/vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c: In function 'fileline_init
alize':
/vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c:58: error: implicit declarat
ion of function 'abort'

The following patch fixes this by including <stdlib.h> for the abort()
declaration in the affected files.  It allows the Solaris 11 bootstrap
to continue.

Ok for mainline?

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.

	Rainer


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

	* fileline.c: Include <stdlib.h>.
	* mmap.c: Likewise.

Comments

Richard Biener Sept. 18, 2012, 8:54 a.m. UTC | #1
On Tue, Sep 18, 2012 at 10: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):

Ouch, that's bad.

> stage1 config.h has
>
> /* #undef HAVE_SYNC_FUNCTIONS */
>
> and fileline.c and mmap.c fail to compile:
>
> /vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c: In function 'fileline_init
> alize':
> /vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c:58: error: implicit declarat
> ion of function 'abort'
>
> The following patch fixes this by including <stdlib.h> for the abort()
> declaration in the affected files.  It allows the Solaris 11 bootstrap
> to continue.
>
> Ok for mainline?

Ok.

Thanks,
Richard.

> 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.
>
>         Rainer
>
>
> 2012-09-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
>         * fileline.c: Include <stdlib.h>.
>         * mmap.c: Likewise.
>
>
>
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
Richard Biener Sept. 18, 2012, 8:55 a.m. UTC | #2
On Tue, Sep 18, 2012 at 10:54 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Tue, Sep 18, 2012 at 10: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):
>
> Ouch, that's bad.

Btw, why do we need to build libbacktrace during stage1?

>> stage1 config.h has
>>
>> /* #undef HAVE_SYNC_FUNCTIONS */
>>
>> and fileline.c and mmap.c fail to compile:
>>
>> /vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c: In function 'fileline_init
>> alize':
>> /vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c:58: error: implicit declarat
>> ion of function 'abort'
>>
>> The following patch fixes this by including <stdlib.h> for the abort()
>> declaration in the affected files.  It allows the Solaris 11 bootstrap
>> to continue.
>>
>> Ok for mainline?
>
> Ok.
>
> Thanks,
> Richard.
>
>> 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.
>>
>>         Rainer
>>
>>
>> 2012-09-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>>         * fileline.c: Include <stdlib.h>.
>>         * mmap.c: Likewise.
>>
>>
>>
>>
>> --
>> -----------------------------------------------------------------------------
>> Rainer Orth, Center for Biotechnology, Bielefeld University
>>
Ian Lance Taylor Sept. 18, 2012, 4:20 p.m. UTC | #3
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
__sync_* support.  Might be worth looking into why the test failed.

> 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.

Sorry about the problems.

Ian
Ian Lance Taylor Sept. 18, 2012, 4:21 p.m. UTC | #4
On Tue, Sep 18, 2012 at 1:55 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Tue, Sep 18, 2012 at 10:54 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Tue, Sep 18, 2012 at 10: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):
>>
>> Ouch, that's bad.
>
> Btw, why do we need to build libbacktrace during stage1?

It's easier for users.  The library is designed to quietly do nothing
if it does not have the required support.  This was just a bug in that
design.

Ian
diff mbox

Patch

# HG changeset patch
# Parent a22dd5d7246fa4e8a73de2e66db7594cf9ae9f5a
Fix bootstrap with gcc 4.4

diff --git a/libbacktrace/fileline.c b/libbacktrace/fileline.c
--- a/libbacktrace/fileline.c
+++ b/libbacktrace/fileline.c
@@ -35,6 +35,7 @@  POSSIBILITY OF SUCH DAMAGE.  */
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 #include "backtrace.h"
 #include "internal.h"
diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c
--- a/libbacktrace/mmap.c
+++ b/libbacktrace/mmap.c
@@ -34,6 +34,7 @@  POSSIBILITY OF SUCH DAMAGE.  */
 
 #include <errno.h>
 #include <string.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/mman.h>