aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lto-plugin/ChangeLog16
-rw-r--r--lto-plugin/config.h.in4
-rwxr-xr-xlto-plugin/configure86
-rw-r--r--lto-plugin/configure.ac1
-rw-r--r--lto-plugin/lto-plugin.c28
5 files changed, 125 insertions, 10 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 690ea5a..3db5448 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -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
diff --git a/lto-plugin/config.h.in b/lto-plugin/config.h.in
index d7750f1..9c99e88 100644
--- a/lto-plugin/config.h.in
+++ b/lto-plugin/config.h.in
@@ -75,6 +75,10 @@
#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
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 78948f9..154c5bf 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -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) ;; #(
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 282115f..15bc1a6 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -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)
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 83b61d5..78eb109 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -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;
}