Re: [PATCH 2/2] Detect 64-bit-ness in PowerPC Book III-E

Ulrich Weigand
2015-01-14T12:47:09Z

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