aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gold/config.in12
-rwxr-xr-xgold/configure89
-rw-r--r--gold/configure.ac69
-rw-r--r--gold/dynobj.cc32
-rw-r--r--gold/layout.cc60
-rw-r--r--gold/object.cc46
-rw-r--r--gold/output.cc49
-rw-r--r--gold/reloc.cc48
-rw-r--r--gold/resolve.cc24
-rw-r--r--gold/symtab.cc72
10 files changed, 457 insertions, 44 deletions
diff --git a/gold/config.in b/gold/config.in
index 1d40c66..ba337b8 100644
--- a/gold/config.in
+++ b/gold/config.in
@@ -37,6 +37,18 @@
/* 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
diff --git a/gold/configure b/gold/configure
index 5d69594..de4de03 100755
--- a/gold/configure
+++ b/gold/configure
@@ -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'
diff --git a/gold/configure.ac b/gold/configure.ac
index 5cbaf2c..402933d 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -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
diff --git a/gold/dynobj.cc b/gold/dynobj.cc
index 1bd5a85..874b4e7 100644
--- a/gold/dynobj.cc
+++ b/gold/dynobj.cc
@@ -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.
diff --git a/gold/layout.cc b/gold/layout.cc
index 1e8df22..d533722 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -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.
diff --git a/gold/object.cc b/gold/object.cc
index eb975c6..0fb4526 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -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.
diff --git a/gold/output.cc b/gold/output.cc
index 2a7400d..ddf2ebb 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -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.
-
diff --git a/gold/reloc.cc b/gold/reloc.cc
index 76ab196..cf7ee30 100644
--- a/gold/reloc.cc
+++ b/gold/reloc.cc
@@ -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.
diff --git a/gold/resolve.cc b/gold/resolve.cc
index d021598..e5ca6e3 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -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.
diff --git a/gold/symtab.cc b/gold/symtab.cc
index e4acb31..b7f4aaa 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -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.