This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,AIX] Enable XCOFF in libbacktrace on AIX
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Ian Lance Taylor <iant at golang dot org>
- Cc: "REIX\, Tony" <tony dot reix at atos dot net>, "gcc-patches\@gcc.gnu.org" <gcc-patches at gcc dot gnu dot org>, "SARTER\, MATTHIEU \(ext\)" <matthieu dot sarter dot external at atos dot net>, David Edelsohn <edelsohn at us dot ibm dot com>
- Date: Sun, 23 Jul 2017 11:11:10 +0200
- Subject: Re: [PATCH,AIX] Enable XCOFF in libbacktrace on AIX
- Authentication-results: sourceware.org; auth=none
- References: <B37989F2852398498001550C29155BE5CD355A@FRCRPVV9EX3MSX.ww931.my-it-solutions.net> <CAKOQZ8x5oqExrAn52e8BNzJQdSyrKmJM0oNXO=Nt5LOtUcxeQA@mail.gmail.com>
Hi Ian,
> On Mon, May 15, 2017 at 7:24 AM, REIX, Tony <tony.reix@atos.net> wrote:
>> Description:
>> * This patch enables libbacktrace to handle XCOFF on AIX.
>>
>> Tests:
>> * Fedora25/x86_64 + GCC v7.1.0 : Configure/Build: SUCCESS
>> - build made by means of a .spec file based on Fedora gcc-7.0.1-0.12 .spec file
>> ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
>>
>> ChangeLog:
>> * libbacktrace/Makefile.am : Add xcoff.c
>> * libbacktrace/Makefile.in : Regenerated
>> * libbacktrace/configure.ac : Add XCOFF output file type
>> * libbacktrace/configure : Regenerated
>> * libbacktrace/fileline.c : Handle AIX procfs tree
>> * libbacktrace/filetype.awk : Add AIX XCOFF type detection
>> * libbacktrace/xcoff.c : New file for handling XCOFF format
>
> Thanks. Committed with some minor changes, as follows.
>
> Ian
>
>
> 2017-07-21 Tony Reix <tony.reix@atos.net>
>
> * filetype.awk: Add AIX XCOFF type detection.
> * configure.ac: Recognize xcoff format.
> * Makefile.am (FORMAT_FILES): Add xcoff.c.
> * fileline.c: Include <unistd.h>.
> (fileline_initialize): Add case for AIX procfs.
> * xcoff.c: New file.
> * configure, Makefile.in: Rebuild.
this patch broke Solaris bootstrap:
/vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c: In function 'fileline_initialize':
/vol/gcc/src/hg/trunk/local/libbacktrace/fileline.c:105:41: error: format '%d' expects argument of type 'int', but argument 4 has type 'pid_t {aka long int}' [-Werror=format=]
snprintf (buf, sizeof (buf), "/proc/%d/object/a.out", getpid ());
~^ ~~~~~~~~~
%ld
The following patch allowed bootstrap to finish.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2017-07-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* fileline.c (fileline_initialize): Print pid_t as long.
diff --git a/libbacktrace/fileline.c b/libbacktrace/fileline.c
--- a/libbacktrace/fileline.c
+++ b/libbacktrace/fileline.c
@@ -102,7 +102,8 @@ fileline_initialize (struct backtrace_st
filename = "/proc/curproc/file";
break;
case 4:
- snprintf (buf, sizeof (buf), "/proc/%d/object/a.out", getpid ());
+ snprintf (buf, sizeof (buf), "/proc/%ld/object/a.out",
+ (long) getpid ());
filename = buf;
break;
default: