Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@cygnus.com>
To: gdb-patches@sourceware.cygnus.com, Michael Snyder <msnyder@redhat.com>
Subject: [PATCH RFA] configure.in: HAVE_STRUCT_LINK_MAP32 fix
Date: Sat, 09 Sep 2000 13:20:00 -0000	[thread overview]
Message-ID: <1000909201957.ZM5262@ocotillo.lan> (raw)

The patch below fix the problem in which HAVE_STRUCT_LINK_MAP32 gets
incorrectly defined for Linux.  The original test is as follows:

    [AC_TRY_RUN([#define _SYSCALL32
     #include <sys/link.h>
     int main()
     {
       if (sizeof (struct link_map32) > 0)
	 return 1;
       return 0;
     }],
     gdb_cv_have_struct_link_map32=no,
     gdb_cv_have_struct_link_map32=yes,
     gdb_cv_have_struct_link_map32=yes)]

The problem with this test is that gdb_cv_have_struct_link_map32 is
defined to be no if the program compiles successfully *and* returns
0 when run.  It will be defined to be yes otherwise.  So, on the
appropriate Solaris system, the test would compile, but the program
would exit with status code 1 (not 0), thus causing the autoconf
variable to be defined to yes.

On Linux, the compilation would simply fail because Linux lacks a
<sys/link.h> file.  This would also cause the autoconf variable to
be set to yes.  (Not what we want.)

I don't think it would ever be possible for the autoconf variable
to be set to no.  For this to happen, there would have to be a
struct link_map32 declared which is also of zero size.

In order for the above test to work, it would have to be written
as follows:

    [AC_TRY_RUN([#define _SYSCALL32
     #include <sys/link.h>
     int main()
     {
       if (sizeof (struct link_map32) > 0)
	 return 0;
       return 1;
     }],
     gdb_cv_have_struct_link_map32=yes,
     gdb_cv_have_struct_link_map32=no,
     gdb_cv_have_struct_link_map32=no)]

Note that the 0 and 1 were interchanged as were the yes/no values.

However, I don't think AC_TRY_RUN is really appropriate in this case
anyway because it effectively precludes the use of a cross compiler.
Instead, I think AC_TRY_COMPILE is sufficient for making the test
work properly.

This has been tested on Linux, but not on Solaris.

Please let me know if it's okay to commit this patch.

	* configure.in (HAVE_STRUCT_LINK_MAP32): Change test to use
	AC_TRY_COMPILE instead of AC_TRY_RUN.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.43
diff -u -p -r1.43 configure.in
--- configure.in	2000/08/30 00:58:58	1.43
+++ configure.in	2000/09/09 20:01:41
@@ -239,17 +239,10 @@ if test "$ac_cv_header_sys_procfs_h" = y
 
   AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
   AC_CACHE_VAL(gdb_cv_have_struct_link_map32, 
-    [AC_TRY_RUN([#define _SYSCALL32
-     #include <sys/link.h>
-     int main()
-     {
-       if (sizeof (struct link_map32) > 0)
-	 return 1;
-       return 0;
-     }],
-     gdb_cv_have_struct_link_map32=no,
+    [AC_TRY_COMPILE([#define _SYSCALL32
+#include <sys/link.h>], [struct link_map32 l;],
      gdb_cv_have_struct_link_map32=yes,
-     gdb_cv_have_struct_link_map32=yes)])
+     gdb_cv_have_struct_link_map32=no)])
   AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
   if test $gdb_cv_have_struct_link_map32 = yes; then
     AC_DEFINE(HAVE_STRUCT_LINK_MAP32)


             reply	other threads:[~2000-09-09 13:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-09 13:20 Kevin Buettner [this message]
2000-09-11 11:37 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000909201957.ZM5262@ocotillo.lan \
    --to=kevinb@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=msnyder@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox