OSDN Git Service

* configure.ac: Test for the name of the symbol used for the entry
authormacro <macro@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Aug 2005 16:15:16 +0000 (16:15 +0000)
committermacro <macro@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Aug 2005 16:15:16 +0000 (16:15 +0000)
point; define ENTRY_POINT to the result.
* configure: Regenerate.
* config.h.in: Regenerate.
* mf-heuristics.c: Replace _start with ENTRY_POINT throughout.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103113 138bc75d-0d04-0410-961f-82ee72b054a4

libmudflap/ChangeLog
libmudflap/config.h.in
libmudflap/configure
libmudflap/configure.ac
libmudflap/mf-heuristics.c

index ad61663..c42fa25 100644 (file)
@@ -1,3 +1,11 @@
+2005-08-15  Maciej W. Rozycki  <macro@linux-mips.org>
+
+       * configure.ac: Test for the name of the symbol used for the entry
+       point; define ENTRY_POINT to the result.
+       * configure: Regenerate.
+       * config.h.in: Regenerate.
+       * mf-heuristics.c: Replace _start with ENTRY_POINT throughout.
+
 2005-08-14  Ulrich Weigand  <weigand@informatik.uni-erlangen.de>
 
        * mf-runtime.c (__mf_state_1): Initialize to reentrant.
 2005-08-14  Ulrich Weigand  <weigand@informatik.uni-erlangen.de>
 
        * mf-runtime.c (__mf_state_1): Initialize to reentrant.
index b14e2e9..98c3f61 100644 (file)
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define to the name of the symbol used for the entry point. */
+#undef ENTRY_POINT
+
 /* Define to 1 if you have the `addmntent' function. */
 #undef HAVE_ADDMNTENT
 
 /* Define to 1 if you have the `addmntent' function. */
 #undef HAVE_ADDMNTENT
 
index 03b3be5..3fe9a1a 100755 (executable)
@@ -6894,6 +6894,76 @@ echo "${ECHO_T}$ac_fdsections" >&6
 
 
 
 
 
 
+# Check for the name of the symbol used for the entry point.
+echo "$as_me:$LINENO: checking for the name of the symbol used for the entry point" >&5
+echo $ECHO_N "checking for the name of the symbol used for the entry point... $ECHO_C" >&6
+if test "${mudflap_cv_entry_point+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+for name in _start __start unknown; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+extern char $name;
+int
+main ()
+{
+$name = 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+done
+mudflap_cv_entry_point="$name"
+fi
+echo "$as_me:$LINENO: result: $mudflap_cv_entry_point" >&5
+echo "${ECHO_T}$mudflap_cv_entry_point" >&6
+if test "$mudflap_cv_entry_point" = unknown; then
+  { { echo "$as_me:$LINENO: error: none of the known symbol names works" >&5
+echo "$as_me: error: none of the known symbol names works" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define ENTRY_POINT $mudflap_cv_entry_point
+_ACEOF
+
+
+
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
index 58a7c73..4d0ff13 100644 (file)
@@ -223,6 +223,21 @@ AC_MSG_RESULT($ac_fdsections)
 AC_SUBST(SECTION_FLAGS)
 
 
 AC_SUBST(SECTION_FLAGS)
 
 
+# Check for the name of the symbol used for the entry point.
+AC_CACHE_CHECK([for the name of the symbol used for the entry point],
+  [mudflap_cv_entry_point], [
+for name in _start __start unknown; do
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char $name;], [$name = 0;])],
+                [break])
+done
+mudflap_cv_entry_point="$name"])
+if test "$mudflap_cv_entry_point" = unknown; then
+  AC_MSG_ERROR([none of the known symbol names works])
+fi
+AC_DEFINE_UNQUOTED([ENTRY_POINT], [$mudflap_cv_entry_point],
+  [Define to the name of the symbol used for the entry point.])
+
+
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
 if test ${multilib} = yes; then
   multilib_arg="--enable-multilib"
 else
index df2a039..9118bc6 100644 (file)
@@ -43,7 +43,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 
 extern char _end;
 
 
 extern char _end;
-extern char _start;
+extern char ENTRY_POINT;
 
 
 /* Run some quick validation of the given region.
 
 
 /* Run some quick validation of the given region.
@@ -164,10 +164,11 @@ __mf_heuristic_check (uintptr_t ptr, uintptr_t ptr_high)
     }
 
 
     }
 
 
-  /* The third heuristic is to approve all accesses between _start and _end,
-     which should include all text and initialized data.  */
+  /* The third heuristic is to approve all accesses between _start (or its
+     equivalent for the given target) and _end, which should include all
+     text and initialized data.  */
   if (__mf_opts.heur_start_end)
   if (__mf_opts.heur_start_end)
-    if (ptr >= (uintptr_t) & _start && ptr_high <= (uintptr_t) & _end)
+    if (ptr >= (uintptr_t) & ENTRY_POINT && ptr_high <= (uintptr_t) & _end)
       return 1; /* uncacheable */
 
   return 0; /* unknown */
       return 1; /* uncacheable */
 
   return 0; /* unknown */