This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] Detect 64-bit-ness in PowerPC Book III-E
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: yao at codesourcery dot com (Yao Qi)
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 14 Jan 2015 13:46:59 +0100 (CET)
- Subject: Re: [PATCH 2/2] Detect 64-bit-ness in PowerPC Book III-E
- Authentication-results: sourceware.org; auth=none
Yao Qi wrote:
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -1318,6 +1318,9 @@ AC_CHECK_FUNCS([getrusage getuid getgid \
> ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
> setrlimit getrlimit posix_madvise waitpid \
> ptrace64 sigaltstack mkdtemp])
> +# glibc >= 2.16 provides getauxval().
> +AC_CHECK_FUNCS(getauxval)
> +
Any reason why this has to be a second AC_CHECK_FUNCS ? I thought
we usually just add functions to the one AC_CHECK_FUNCS call ...
> --- a/gdb/gdbserver/configure.ac
> +++ b/gdb/gdbserver/configure.ac
> @@ -91,6 +91,8 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h str=
> ing.h dnl
> sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
> netinet/tcp.h arpa/inet.h)
> AC_CHECK_FUNCS(pread pwrite pread64)
> +# glibc >= 2.16 provides getauxval().
> +AC_CHECK_FUNCS(getauxval)
Likewise.
> + unsigned char data[2 * 8];
> + FILE *f = fopen ("/proc/self/auxv", "r");
> +
> + if (f == NULL)
> + return;
> +
> + while (fread (data, sizeof (data), 1, f) > 0)
> + {
> + unsigned long *data_p = (unsigned long *) data;
Hmm, this looks a violation of C aliasing rules. It would
be better to declare the array as unsigned long in the first
place, and cast to char for the fread call. Sorry for not
noticing that in the first review.
Otherwise this looks good.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com