Add support for --enable-target to control which template
authorIan Lance Taylor <iant@google.com>
Tue, 4 Sep 2007 20:00:53 +0000 (20:00 +0000)
committerIan Lance Taylor <iant@google.com>
Tue, 4 Sep 2007 20:00:53 +0000 (20:00 +0000)
specializations we generate.

gold/config.in
gold/configure
gold/configure.ac
gold/dynobj.cc
gold/layout.cc
gold/object.cc
gold/output.cc
gold/reloc.cc
gold/resolve.cc
gold/symtab.cc

index 1d40c66bac36d272919093764acf03e52f3522f4..ba337b88aaadb498235d40d7fed2b3b5993102ca 100644 (file)
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to support 32-bit big-endian targets */
+#undef HAVE_TARGET_32_BIG
+
+/* Define to support 32-bit little-endian targets */
+#undef HAVE_TARGET_32_LITTLE
+
+/* Define to support 64-bit big-endian targets */
+#undef HAVE_TARGET_64_BIG
+
+/* Define to support 64-bit little-endian targets */
+#undef HAVE_TARGET_64_LITTLE
+
 /* Define to 1 if you have the <tr1/unordered_map> header file. */
 #undef HAVE_TR1_UNORDERED_MAP
 
index 5d69594d33fb7fa2589f9ff67fa2e5e30a2387d6..de4de033dac4160f0c0e0350cc392f5c1ee68a6c 100755 (executable)
@@ -858,6 +858,7 @@ if test -n "$ac_init_help"; then
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-targets        alternative target configurations
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --disable-nls           do not use Native Language Support
@@ -1841,6 +1842,94 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
           ac_config_headers="$ac_config_headers config.h:config.in"
 
 
+# Check whether --enable-targets or --disable-targets was given.
+if test "${enable_targets+set}" = set; then
+  enableval="$enable_targets"
+  case "${enableval}" in
+  yes | "")
+    { { echo "$as_me:$LINENO: error: --enable-targets option must specify target names or 'all'" >&5
+echo "$as_me: error: --enable-targets option must specify target names or 'all'" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  no)
+    enable_targets=
+    ;;
+  *)
+    enable_targets=$enableval
+    ;;
+esac
+else
+  # For now, enable all targets by default
+ enable_targets=all
+
+fi;
+
+# Canonicalize the enabled targets.
+if test -n "$enable_targets"; then
+  for targ in `echo $enable_targets | sed -e 's/,/ /g'`; do
+    result=`$ac_config_sub $targ 2>/dev/null`
+    if test -n "$result"; then
+      canon_targets="$canon_targets $result"
+    else
+      # Permit unrecognized target names, like "all".
+      canon_targets="$canon_targets $targ"
+    fi
+  done
+fi
+
+# See which specific instantiations we need.
+for targ in $target $canon_targets; do
+  targ_32_little=
+  targ_32_big=
+  targ_64_little=
+  targ_64_big=
+  if test "$targ" = "all"; then
+    targ_32_little=yes
+    targ_32_big=yes
+    targ_64_little=yes
+    targ_64_big=yes
+  else
+    case "$targ" in
+    i?86-*) targ_32_little=yes ;;
+    x86_64-*) targ_64_little=yes ;;
+    *)
+      { { echo "$as_me:$LINENO: error: \"target $targ: unknown size and endianness\"" >&5
+echo "$as_me: error: \"target $targ: unknown size and endianness\"" >&2;}
+   { (exit 1); exit 1; }; }
+      ;;
+    esac
+  fi
+done
+
+if test -n "$targ_32_little"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TARGET_32_LITTLE 1
+_ACEOF
+
+fi
+if test -n "$targ_32_big"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TARGET_32_BIG 1
+_ACEOF
+
+fi
+if test -n "$targ_64_little"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TARGET_64_LITTLE 1
+_ACEOF
+
+fi
+if test -n "$targ_64_big"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TARGET_64_BIG 1
+_ACEOF
+
+fi
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
index 5cbaf2c455d9cd011b4324110bb8f3d249452b37..402933d412831560279482b4997c137f8f7d906b 100644 (file)
@@ -10,6 +10,75 @@ AM_INIT_AUTOMAKE(gold, 0.1)
 
 AM_CONFIG_HEADER(config.h:config.in)
 
+AC_ARG_ENABLE([targets],
+[  --enable-targets        alternative target configurations],
+[case "${enableval}" in
+  yes | "")
+    AC_MSG_ERROR([--enable-targets option must specify target names or 'all'])
+    ;;
+  no)
+    enable_targets=
+    ;;
+  *)
+    enable_targets=$enableval
+    ;;
+esac],
+[# For now, enable all targets by default
+ enable_targets=all
+])
+
+# Canonicalize the enabled targets.
+if test -n "$enable_targets"; then
+  for targ in `echo $enable_targets | sed -e 's/,/ /g'`; do
+    result=`$ac_config_sub $targ 2>/dev/null`
+    if test -n "$result"; then
+      canon_targets="$canon_targets $result"
+    else
+      # Permit unrecognized target names, like "all".
+      canon_targets="$canon_targets $targ"
+    fi
+  done
+fi
+
+# See which specific instantiations we need.
+for targ in $target $canon_targets; do
+  targ_32_little=
+  targ_32_big=
+  targ_64_little=
+  targ_64_big=
+  if test "$targ" = "all"; then
+    targ_32_little=yes
+    targ_32_big=yes
+    targ_64_little=yes
+    targ_64_big=yes
+  else
+    case "$targ" in
+    i?86-*) targ_32_little=yes ;;
+    x86_64-*) targ_64_little=yes ;;
+    *)
+      AC_MSG_ERROR("target $targ: unknown size and endianness")
+      ;;
+    esac
+  fi
+done
+
+if test -n "$targ_32_little"; then
+  AC_DEFINE(HAVE_TARGET_32_LITTLE, 1,
+             [Define to support 32-bit little-endian targets])
+fi
+if test -n "$targ_32_big"; then
+  AC_DEFINE(HAVE_TARGET_32_BIG, 1,
+             [Define to support 32-bit big-endian targets])
+fi
+if test -n "$targ_64_little"; then
+  AC_DEFINE(HAVE_TARGET_64_LITTLE, 1,
+             [Define to support 64-bit little-endian targets])
+fi
+if test -n "$targ_64_big"; then
+  AC_DEFINE(HAVE_TARGET_64_BIG, 1,
+             [Define to support 64-bit big-endian targets])
+fi
+
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_YACC
index 1bd5a85e4392bcecd93a4caff55790a3ed847499..874b4e7fcb4c4214ad7584067cf708ec4c547ee7 100644 (file)
@@ -1520,18 +1520,27 @@ Versions::need_section_contents(const Stringpool* dynpool,
 // Instantiate the templates we need.  We could use the configure
 // script to restrict this to only the ones for implemented targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Sized_dynobj<32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Sized_dynobj<32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Sized_dynobj<64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Sized_dynobj<64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Versions::symbol_section_contents<32, false>(
@@ -1541,7 +1550,9 @@ Versions::symbol_section_contents<32, false>(
     unsigned char**,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Versions::symbol_section_contents<32, true>(
@@ -1551,7 +1562,9 @@ Versions::symbol_section_contents<32, true>(
     unsigned char**,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Versions::symbol_section_contents<64, false>(
@@ -1561,7 +1574,9 @@ Versions::symbol_section_contents<64, false>(
     unsigned char**,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Versions::symbol_section_contents<64, true>(
@@ -1571,7 +1586,9 @@ Versions::symbol_section_contents<64, true>(
     unsigned char**,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Versions::def_section_contents<32, false>(
@@ -1580,7 +1597,9 @@ Versions::def_section_contents<32, false>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Versions::def_section_contents<32, true>(
@@ -1589,7 +1608,9 @@ Versions::def_section_contents<32, true>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Versions::def_section_contents<64, false>(
@@ -1598,7 +1619,9 @@ Versions::def_section_contents<64, false>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Versions::def_section_contents<64, true>(
@@ -1607,7 +1630,9 @@ Versions::def_section_contents<64, true>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Versions::need_section_contents<32, false>(
@@ -1616,7 +1641,9 @@ Versions::need_section_contents<32, false>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Versions::need_section_contents<32, true>(
@@ -1625,7 +1652,9 @@ Versions::need_section_contents<32, true>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Versions::need_section_contents<64, false>(
@@ -1634,7 +1663,9 @@ Versions::need_section_contents<64, false>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Versions::need_section_contents<64, true>(
@@ -1643,5 +1674,6 @@ Versions::need_section_contents<64, true>(
     unsigned int*,
     unsigned int*
     ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const;
+#endif
 
 } // End namespace gold.
index 1e8df2288ec0d50c64c7e186988bbeeeab2ad1dd..d533722687569d7c71a3d4c4d642af0fdf78b134 100644 (file)
@@ -986,24 +986,52 @@ Layout::create_version_sections(const Target* target, const Versions* versions,
   if (target->get_size() == 32)
     {
       if (target->is_big_endian())
-       this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(32, true)(
-            versions, local_symcount, dynamic_symbols, dynstr
-            SELECT_SIZE_ENDIAN(32, true));
+        {
+#ifdef HAVE_TARGET_32_BIG
+          this->sized_create_version_sections
+              SELECT_SIZE_ENDIAN_NAME(32, true)(
+                  versions, local_symcount, dynamic_symbols, dynstr
+                  SELECT_SIZE_ENDIAN(32, true));
+#else
+          gold_unreachable();
+#endif
+        }
       else
-       this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(32, false)(
-            versions, local_symcount, dynamic_symbols, dynstr
-            SELECT_SIZE_ENDIAN(32, false));
+        {
+#ifdef HAVE_TARGET_32_LITTLE
+          this->sized_create_version_sections
+              SELECT_SIZE_ENDIAN_NAME(32, false)(
+                  versions, local_symcount, dynamic_symbols, dynstr
+                  SELECT_SIZE_ENDIAN(32, false));
+#else
+          gold_unreachable();
+#endif
+        }
     }
   else if (target->get_size() == 64)
     {
       if (target->is_big_endian())
-       this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(64, true)(
-            versions, local_symcount, dynamic_symbols, dynstr
-            SELECT_SIZE_ENDIAN(64, true));
+        {
+#ifdef HAVE_TARGET_64_BIG
+          this->sized_create_version_sections
+              SELECT_SIZE_ENDIAN_NAME(64, true)(
+                  versions, local_symcount, dynamic_symbols, dynstr
+                  SELECT_SIZE_ENDIAN(64, true));
+#else
+          gold_unreachable();
+#endif
+        }
       else
-       this->sized_create_version_sections SELECT_SIZE_ENDIAN_NAME(64, false)(
-            versions, local_symcount, dynamic_symbols, dynstr
-            SELECT_SIZE_ENDIAN(64, false));
+        {
+#ifdef HAVE_TARGET_64_LITTLE
+          this->sized_create_version_sections
+              SELECT_SIZE_ENDIAN_NAME(64, false)(
+                  versions, local_symcount, dynamic_symbols, dynstr
+                  SELECT_SIZE_ENDIAN(64, false));
+#else
+          gold_unreachable();
+#endif
+        }
     }
   else
     gold_unreachable();
@@ -1449,25 +1477,33 @@ Close_task_runner::run(Workqueue*)
 // Instantiate the templates we need.  We could use the configure
 // script to restrict this to only the ones for implemented targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 Output_section*
 Layout::layout<32, false>(Relobj* object, unsigned int shndx, const char* name,
                          const elfcpp::Shdr<32, false>& shdr, off_t*);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 Output_section*
 Layout::layout<32, true>(Relobj* object, unsigned int shndx, const char* name,
                         const elfcpp::Shdr<32, true>& shdr, off_t*);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 Output_section*
 Layout::layout<64, false>(Relobj* object, unsigned int shndx, const char* name,
                          const elfcpp::Shdr<64, false>& shdr, off_t*);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 Output_section*
 Layout::layout<64, true>(Relobj* object, unsigned int shndx, const char* name,
                         const elfcpp::Shdr<64, true>& shdr, off_t*);
+#endif
 
 
 } // End namespace gold.
index eb975c6c73450f4dea561bdb3ee00b707e74b8d3..0fb45263695af46977f6f6cef20b7750087a7618 100644 (file)
@@ -493,7 +493,7 @@ Sized_relobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
 
   const char* sym_names =
     reinterpret_cast<const char*>(sd->symbol_names->data());
-  symtab->add_from_relobj(this, sd->symbols->data(), symcount, sym_names, 
+  symtab->add_from_relobj(this, sd->symbols->data(), symcount, sym_names,
                          sd->symbol_names_size, this->symbols_);
 
   delete sd->symbols;
@@ -909,15 +909,29 @@ make_elf_object(const std::string& name, Input_file* input_file, off_t offset,
        }
       if (big_endian)
        {
+#ifdef HAVE_TARGET_32_BIG
          elfcpp::Ehdr<32, true> ehdr(p);
          return make_elf_sized_object<32, true>(name, input_file,
                                                 offset, ehdr);
+#else
+          fprintf(stderr,
+                  _("%s: %s: not configured to support 32-bit big-endian object\n"),
+                  program_name, name.c_str());
+          gold_exit(false);
+#endif
        }
       else
        {
+#ifdef HAVE_TARGET_32_LITTLE
          elfcpp::Ehdr<32, false> ehdr(p);
          return make_elf_sized_object<32, false>(name, input_file,
                                                  offset, ehdr);
+#else
+          fprintf(stderr,
+                  _("%s: %s: not configured to support 32-bit little-endian object\n"),
+                  program_name, name.c_str());
+          gold_exit(false);
+#endif
        }
     }
   else
@@ -930,15 +944,29 @@ make_elf_object(const std::string& name, Input_file* input_file, off_t offset,
        }
       if (big_endian)
        {
+#ifdef HAVE_TARGET_64_BIG
          elfcpp::Ehdr<64, true> ehdr(p);
          return make_elf_sized_object<64, true>(name, input_file,
                                                 offset, ehdr);
+#else
+          fprintf(stderr,
+                  _("%s: %s: not configured to support 64-bit big-endian object\n"),
+                  program_name, name.c_str());
+          gold_exit(false);
+#endif
        }
       else
        {
+#ifdef HAVE_TARGET_64_LITTLE
          elfcpp::Ehdr<64, false> ehdr(p);
          return make_elf_sized_object<64, false>(name, input_file,
                                                  offset, ehdr);
+#else
+          fprintf(stderr,
+                  _("%s: %s: not configured to support 64-bit little-endian object\n"),
+                  program_name, name.c_str());
+          gold_exit(false);
+#endif
        }
     }
 }
@@ -946,28 +974,44 @@ make_elf_object(const std::string& name, Input_file* input_file, off_t offset,
 // Instantiate the templates we need.  We could use the configure
 // script to restrict this to only the ones for implemented targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Sized_relobj<32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Sized_relobj<32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Sized_relobj<64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Sized_relobj<64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 struct Relocate_info<32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 struct Relocate_info<32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 struct Relocate_info<64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 struct Relocate_info<64, true>;
+#endif
 
 } // End namespace gold.
index 2a7400def77ca342530fde4e203532150d153cc8..ddf2ebb4e63c2c9f14fcdddc7f3340c6ed35423b 100644 (file)
@@ -1574,6 +1574,7 @@ Output_file::close()
 // Instantiate the templates we need.  We could use the configure
 // script to restrict this to only the ones for implemented targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 off_t
 Output_section::add_input_section<32, false>(
@@ -1581,7 +1582,9 @@ Output_section::add_input_section<32, false>(
     unsigned int shndx,
     const char* secname,
     const elfcpp::Shdr<32, false>& shdr);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 off_t
 Output_section::add_input_section<32, true>(
@@ -1589,7 +1592,9 @@ Output_section::add_input_section<32, true>(
     unsigned int shndx,
     const char* secname,
     const elfcpp::Shdr<32, true>& shdr);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 off_t
 Output_section::add_input_section<64, false>(
@@ -1597,7 +1602,9 @@ Output_section::add_input_section<64, false>(
     unsigned int shndx,
     const char* secname,
     const elfcpp::Shdr<64, false>& shdr);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 off_t
 Output_section::add_input_section<64, true>(
@@ -1605,66 +1612,106 @@ Output_section::add_input_section<64, true>(
     unsigned int shndx,
     const char* secname,
     const elfcpp::Shdr<64, true>& shdr);
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_REL, false, 32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Output_data_reloc<elfcpp::SHT_REL, false, 32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_REL, false, 64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Output_data_reloc<elfcpp::SHT_REL, false, 64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_REL, true, 32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Output_data_reloc<elfcpp::SHT_REL, true, 32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_REL, true, 64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Output_data_reloc<elfcpp::SHT_REL, true, 64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_RELA, false, 32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Output_data_reloc<elfcpp::SHT_RELA, false, 32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_RELA, false, 64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Output_data_reloc<elfcpp::SHT_RELA, false, 64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_RELA, true, 32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Output_data_reloc<elfcpp::SHT_RELA, true, 32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Output_data_reloc<elfcpp::SHT_RELA, true, 64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Output_data_reloc<elfcpp::SHT_RELA, true, 64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Output_data_got<32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Output_data_got<32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Output_data_got<64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Output_data_got<64, true>;
+#endif
 
 } // End namespace gold.
-
index 76ab196139530d218cc4622fb81c306cc77fe49b..cf7ee306622ad12ea2c7aaee486be6f8de1599c9 100644 (file)
@@ -611,128 +611,176 @@ Copy_relocs<size, big_endian>::emit(
 // Instantiate the templates we need.  We could use the configure
 // script to restrict this to only the ones for implemented targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Sized_relobj<32, false>::do_read_relocs(Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Sized_relobj<32, true>::do_read_relocs(Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Sized_relobj<64, false>::do_read_relocs(Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Sized_relobj<64, true>::do_read_relocs(Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Sized_relobj<32, false>::do_scan_relocs(const General_options& options,
                                        Symbol_table* symtab,
                                        Layout* layout,
                                        Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Sized_relobj<32, true>::do_scan_relocs(const General_options& options,
                                       Symbol_table* symtab,
                                       Layout* layout,
                                       Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Sized_relobj<64, false>::do_scan_relocs(const General_options& options,
                                        Symbol_table* symtab,
                                        Layout* layout,
                                        Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Sized_relobj<64, true>::do_scan_relocs(const General_options& options,
                                       Symbol_table* symtab,
                                       Layout* layout,
                                       Read_relocs_data* rd);
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Sized_relobj<32, false>::do_relocate(const General_options& options,
                                     const Symbol_table* symtab,
                                     const Layout* layout,
                                     Output_file* of);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Sized_relobj<32, true>::do_relocate(const General_options& options,
                                    const Symbol_table* symtab,
                                    const Layout* layout,
                                    Output_file* of);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Sized_relobj<64, false>::do_relocate(const General_options& options,
                                     const Symbol_table* symtab,
                                     const Layout* layout,
                                     Output_file* of);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Sized_relobj<64, true>::do_relocate(const General_options& options,
                                    const Symbol_table* symtab,
                                    const Layout* layout,
                                    Output_file* of);
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 class Copy_relocs<32, false>;
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 class Copy_relocs<32, true>;
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 class Copy_relocs<64, false>;
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 class Copy_relocs<64, true>;
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Copy_relocs<32, false>::emit<elfcpp::SHT_REL>(
     Output_data_reloc<elfcpp::SHT_REL, true, 32, false>*);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Copy_relocs<32, true>::emit<elfcpp::SHT_REL>(
     Output_data_reloc<elfcpp::SHT_REL, true, 32, true>*);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Copy_relocs<64, false>::emit<elfcpp::SHT_REL>(
     Output_data_reloc<elfcpp::SHT_REL, true, 64, false>*);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Copy_relocs<64, true>::emit<elfcpp::SHT_REL>(
     Output_data_reloc<elfcpp::SHT_REL, true, 64, true>*);
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
 Copy_relocs<32, false>::emit<elfcpp::SHT_RELA>(
     Output_data_reloc<elfcpp::SHT_RELA , true, 32, false>*);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
 Copy_relocs<32, true>::emit<elfcpp::SHT_RELA>(
     Output_data_reloc<elfcpp::SHT_RELA, true, 32, true>*);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
 Copy_relocs<64, false>::emit<elfcpp::SHT_RELA>(
     Output_data_reloc<elfcpp::SHT_RELA, true, 64, false>*);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
 Copy_relocs<64, true>::emit<elfcpp::SHT_RELA>(
     Output_data_reloc<elfcpp::SHT_RELA, true, 64, true>*);
+#endif
 
 } // End namespace gold.
index d02159824af1d660afc25810d145f33f779957e8..e5ca6e38c9991f3ef713fa5663bd966925b0e644 100644 (file)
@@ -520,36 +520,44 @@ Symbol_table::resolve(Sized_symbol<size>* to,
 // script to restrict this to only the ones needed for implemented
 // targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
-Symbol_table::resolve<32, true>(
+Symbol_table::resolve<32, false>(
     Sized_symbol<32>* to,
-    const elfcpp::Sym<32, true>& sym,
+    const elfcpp::Sym<32, false>& sym,
     Object* object,
     const char* version);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
-Symbol_table::resolve<32, false>(
+Symbol_table::resolve<32, true>(
     Sized_symbol<32>* to,
-    const elfcpp::Sym<32, false>& sym,
+    const elfcpp::Sym<32, true>& sym,
     Object* object,
     const char* version);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
-Symbol_table::resolve<64, true>(
+Symbol_table::resolve<64, false>(
     Sized_symbol<64>* to,
-    const elfcpp::Sym<64, true>& sym,
+    const elfcpp::Sym<64, false>& sym,
     Object* object,
     const char* version);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
-Symbol_table::resolve<64, false>(
+Symbol_table::resolve<64, true>(
     Sized_symbol<64>* to,
-    const elfcpp::Sym<64, false>& sym,
+    const elfcpp::Sym<64, true>& sym,
     Object* object,
     const char* version);
+#endif
 
 } // End namespace gold.
index e4acb318f1628f0ca15ea65a5da9f7569e8bb343..b7f4aaa4ab0e1a605cda380d91113430071fdbc0 100644 (file)
@@ -809,13 +809,25 @@ Symbol_table::do_define_in_output_data(
   Sized_symbol<size>* sym;
 
   if (target->is_big_endian())
-    sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) (
-       target, name, version, only_if_ref
-        SELECT_SIZE_ENDIAN(size, true));
+    {
+#if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
+      sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) (
+          target, name, version, only_if_ref
+          SELECT_SIZE_ENDIAN(size, true));
+#else
+      gold_unreachable();
+#endif
+    }
   else
-    sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) (
-        target, name, version, only_if_ref
-        SELECT_SIZE_ENDIAN(size, false));
+    {
+#if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
+      sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) (
+          target, name, version, only_if_ref
+          SELECT_SIZE_ENDIAN(size, false));
+#else
+      gold_unreachable();
+#endif
+    }
 
   if (sym == NULL)
     return NULL;
@@ -1494,50 +1506,59 @@ Warnings::issue_warning(const Symbol* sym, const std::string& location) const
 // script to restrict this to only the ones needed for implemented
 // targets.
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
-Symbol_table::add_from_relobj<32, true>(
-    Sized_relobj<32, true>* relobj,
+Symbol_table::add_from_relobj<32, false>(
+    Sized_relobj<32, false>* relobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
     size_t sym_name_size,
     Symbol** sympointers);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
-Symbol_table::add_from_relobj<32, false>(
-    Sized_relobj<32, false>* relobj,
+Symbol_table::add_from_relobj<32, true>(
+    Sized_relobj<32, true>* relobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
     size_t sym_name_size,
     Symbol** sympointers);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
-Symbol_table::add_from_relobj<64, true>(
-    Sized_relobj<64, true>* relobj,
+Symbol_table::add_from_relobj<64, false>(
+    Sized_relobj<64, false>* relobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
     size_t sym_name_size,
     Symbol** sympointers);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
-Symbol_table::add_from_relobj<64, false>(
-    Sized_relobj<64, false>* relobj,
+Symbol_table::add_from_relobj<64, true>(
+    Sized_relobj<64, true>* relobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
     size_t sym_name_size,
     Symbol** sympointers);
+#endif
 
+#ifdef HAVE_TARGET_32_LITTLE
 template
 void
-Symbol_table::add_from_dynobj<32, true>(
-    Sized_dynobj<32, true>* dynobj,
+Symbol_table::add_from_dynobj<32, false>(
+    Sized_dynobj<32, false>* dynobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
@@ -1545,11 +1566,13 @@ Symbol_table::add_from_dynobj<32, true>(
     const unsigned char* versym,
     size_t versym_size,
     const std::vector<const char*>* version_map);
+#endif
 
+#ifdef HAVE_TARGET_32_BIG
 template
 void
-Symbol_table::add_from_dynobj<32, false>(
-    Sized_dynobj<32, false>* dynobj,
+Symbol_table::add_from_dynobj<32, true>(
+    Sized_dynobj<32, true>* dynobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
@@ -1557,11 +1580,13 @@ Symbol_table::add_from_dynobj<32, false>(
     const unsigned char* versym,
     size_t versym_size,
     const std::vector<const char*>* version_map);
+#endif
 
+#ifdef HAVE_TARGET_64_LITTLE
 template
 void
-Symbol_table::add_from_dynobj<64, true>(
-    Sized_dynobj<64, true>* dynobj,
+Symbol_table::add_from_dynobj<64, false>(
+    Sized_dynobj<64, false>* dynobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
@@ -1569,11 +1594,13 @@ Symbol_table::add_from_dynobj<64, true>(
     const unsigned char* versym,
     size_t versym_size,
     const std::vector<const char*>* version_map);
+#endif
 
+#ifdef HAVE_TARGET_64_BIG
 template
 void
-Symbol_table::add_from_dynobj<64, false>(
-    Sized_dynobj<64, false>* dynobj,
+Symbol_table::add_from_dynobj<64, true>(
+    Sized_dynobj<64, true>* dynobj,
     const unsigned char* syms,
     size_t count,
     const char* sym_names,
@@ -1581,5 +1608,6 @@ Symbol_table::add_from_dynobj<64, false>(
     const unsigned char* versym,
     size_t versym_size,
     const std::vector<const char*>* version_map);
+#endif
 
 } // End namespace gold.