]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR bootstrap/46397
authordavek <davek@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Nov 2010 13:33:59 +0000 (13:33 +0000)
committerdavek <davek@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Nov 2010 13:33:59 +0000 (13:33 +0000)
PR bootstrap/46362
* configure.ac: Add AC_TYPE_INT64_T test.
* config.h.in: Regenerate.
* configure: Likewise.
* lto-plugin.c (debug): Use char not bool.
(nop): Likewise.
(check_1): Rename from check, and use int not bool for gate argument.
(check): Macro wrapper for the above to coerce gate argument into
boolean-valued integer in case it has pointer type.
(parse_table_entry): Use 0 not false.
(claim_file_handler): Avoid use of PRIx64 by splitting 64-bit size
into two 32-bit parts and printing as hex ints.

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

lto-plugin/ChangeLog
lto-plugin/config.h.in
lto-plugin/configure
lto-plugin/configure.ac
lto-plugin/lto-plugin.c

index 690ea5ac40fe99ef0505562bc072862465be0200..3db5448ba25fed279a6849f0952689c80a5acc85 100644 (file)
@@ -1,3 +1,19 @@
+2010-11-11  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       PR bootstrap/46397
+       PR bootstrap/46362
+       * configure.ac: Add AC_TYPE_INT64_T test.
+       * config.h.in: Regenerate.
+       * configure: Likewise.
+       * lto-plugin.c (debug): Use char not bool.
+       (nop): Likewise.
+       (check_1): Rename from check, and use int not bool for gate argument.
+       (check): Macro wrapper for the above to coerce gate argument into
+       boolean-valued integer in case it has pointer type.
+       (parse_table_entry): Use 0 not false.
+       (claim_file_handler): Avoid use of PRIx64 by splitting 64-bit size
+       into two 32-bit parts and printing as hex ints.
+
 2010-11-03  Dave Korn  <dave.korn.cygwin@gmail.com>
 
        PR lto/46291
index d7750f1e9e8020ae8964bb96bdc4dd86e68303f4..9c99e88b95438e744ecae4aca21b4507795afe40 100644 (file)
    #define below would cause a syntax error. */
 #undef _UINT64_T
 
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int64_t
+
 /* Define to the type of an unsigned integer type of width exactly 64 bits if
    such a type exists and the standard includes do not define it. */
 #undef uint64_t
index 78948f90db4b6744f76f3f86839ddd6a265dfb14..154c5bf23dab212e1ee628adaade8347eaf235b6 100755 (executable)
@@ -1730,6 +1730,77 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+     for ac_type in int$2_t 'int' 'long int' \
+        'long long int' 'short int' 'signed char'; do
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 1))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 1)
+                < ($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 2))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  case $ac_type in #(
+  int$2_t) :
+    eval "$3=yes" ;; #(
+  *) :
+    eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       eval as_val=\$$3
+   if test "x$as_val" = x""no; then :
+
+else
+  break
+fi
+     done
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_find_intX_t
+
 # ac_fn_c_find_uintX_t LINENO BITS VAR
 # ------------------------------------
 # Finds an unsigned integer type with width BITS, setting cache variable VAR
@@ -10434,7 +10505,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10437 "configure"
+#line 10508 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10540,7 +10611,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10543 "configure"
+#line 10614 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10796,6 +10867,17 @@ $as_echo "#define SYM_STYLE ss_none" >>confdefs.h
 
     ;;
 esac
+ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
+case $ac_cv_c_int64_t in #(
+  no|yes) ;; #(
+  *)
+
+cat >>confdefs.h <<_ACEOF
+#define int64_t $ac_cv_c_int64_t
+_ACEOF
+;;
+esac
+
 ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
 case $ac_cv_c_uint64_t in #(
   no|yes) ;; #(
index 282115fddfc9bc83782c03020258051e58dfc242..15bc1a6b53bc058e7c5a07cfd608a64b9f697e2e 100644 (file)
@@ -20,6 +20,7 @@ case $target in
     AC_DEFINE([SYM_STYLE], [ss_none], [Default symbol style])
     ;;
 esac
+AC_TYPE_INT64_T
 AC_TYPE_UINT64_T
 AC_CONFIG_FILES(Makefile)
 AC_CONFIG_HEADERS(config.h)
index 83b61d53188ff1784c77c2d96c7a20ebad35aaa1..78eb10988371675c8420ad291e900c7a638c404d 100644 (file)
@@ -35,6 +35,9 @@ along with this program; see the file COPYING3.  If not see
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
@@ -45,7 +48,6 @@ along with this program; see the file COPYING3.  If not see
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <stdbool.h>
 #include <libiberty.h>
 #include <hashtab.h>
 #include "../gcc/lto/common.h"
@@ -138,8 +140,8 @@ static int lto_wrapper_num_args;
 static char **pass_through_items = NULL;
 static unsigned int num_pass_through_items;
 
-static bool debug;
-static bool nop;
+static char debug;
+static char nop;
 static char *resolution_file = NULL;
 
 /* Set by default from configure.ac, but can be overridden at runtime
@@ -148,7 +150,7 @@ static char *resolution_file = NULL;
 static enum symbol_style sym_style = SYM_STYLE;
 
 static void
-check (bool gate, enum ld_plugin_level level, const char *text)
+check_1 (int gate, enum ld_plugin_level level, const char *text)
 {
   if (gate)
     return;
@@ -164,6 +166,11 @@ check (bool gate, enum ld_plugin_level level, const char *text)
     }
 }
 
+/* This little wrapper allows check to be called with a non-integer
+   first argument, such as a pointer that must be non-NULL.  We can't
+   use c99 bool type to coerce it into range, so we explicitly test.  */
+#define check(GATE, LEVEL, TEXT) check_1 (((GATE) != 0), (LEVEL), (TEXT))
+
 /* Parse an entry of the IL symbol table. The data to be parsed is pointed
    by P and the result is written in ENTRY. The slot number is stored in SLOT.
    Returns the address of the next entry. */
@@ -205,7 +212,7 @@ parse_table_entry (char *p, struct ld_plugin_symbol *entry,
       entry->name = concat ("_", p, NULL);
       break;
     default:
-      check (false, LDPL_FATAL, "invalid symbol style requested");
+      check (0, LDPL_FATAL, "invalid symbol style requested");
       break;
     }
   while (*p)
@@ -825,9 +832,14 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
   if (file->offset != 0)
     {
       char *objname;
-      /* We pass the offset of the actual file, not the archive header. */
-      int t = asprintf (&objname, "%s@0x%" PRIx64, file->name,
-                        (int64_t) file->offset);
+      /* We pass the offset of the actual file, not the archive header.
+         Can't use PRIx64, because that's C99, so we have to print the
+        64-bit hex int as two 32-bit ones. */
+      int lo, hi;
+      lo = file->offset & 0xffffffff;
+      hi = ((int64_t)file->offset >> 32) & 0xffffffff;
+      int t = hi ? asprintf (&objname, "%s@0x%x%08x", file->name, lo, hi)
+               : asprintf (&objname, "%s@0x%x", file->name, lo);
       check (t >= 0, LDPL_FATAL, "asprintf failed");
       lto_file.name = objname;
     }