#include "ansidecl.h"
#include <cstddef>
+#include <cstring>
+#include <stdint.h>
#include <sys/types.h>
#ifndef ENABLE_NLS
// Figure out how to get a hash set and a hash map.
-#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP)
+#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) \
+ && defined(HAVE_TR1_UNORDERED_MAP_REHASH)
#include <tr1/unordered_set>
#include <tr1/unordered_map>
#define Unordered_set std::tr1::unordered_set
#define Unordered_map std::tr1::unordered_map
+#define Unordered_multimap std::tr1::unordered_multimap
+
+#define reserve_unordered_map(map, n) ((map)->rehash(n))
#elif defined(HAVE_EXT_HASH_MAP) && defined(HAVE_EXT_HASH_SET)
#define Unordered_set __gnu_cxx::hash_set
#define Unordered_map __gnu_cxx::hash_map
+#define Unordered_multimap __gnu_cxx::hash_multimap
namespace __gnu_cxx
{
}
+#define reserve_unordered_map(map, n) ((map)->resize(n))
+
#else
// The fallback is to just use set and map.
#define Unordered_set std::set
#define Unordered_map std::map
+#define Unordered_map std::multimap
+
+#define reserve_unordered_map(map, n)
#endif
extern "C" ssize_t pread(int, void*, size_t, off_t);
#endif
+#ifndef HAVE_FTRUNCATE
+extern "C" int ftruncate(int, off_t);
+#endif
+
+#ifndef HAVE_MREMAP
+#define MREMAP_MAYMOVE 1
+extern "C" void *mremap(void *, size_t, size_t, int, ...);
+#endif
+
+#ifndef HAVE_FFSLL
+extern "C" int ffsll(long long);
+#endif
+
+#if !HAVE_DECL_MEMMEM
+extern "C" void *memmem(const void *, size_t, const void *, size_t);
+#endif
+
+#if !HAVE_DECL_STRNDUP
+extern "C" char *strndup(const char *, size_t);
+#endif
+
namespace gold
{
class General_options;
class Command_line;
-class Input_argument_list;
class Dirsearch;
class Input_objects;
class Mapfile;
size_t, off_t, const char* format, ...)
TEMPLATE_ATTRIBUTE_PRINTF_4;
-// This function is called to report an undefined symbol.
+// This function is called to report an undefined symbol without
+// a relocation (e.g., referenced by a dynamic object). SYM is
+// the undefined symbol. The file name associated with the SYM
+// is used to print a location for the undefined symbol.
+extern void
+gold_undefined_symbol(const Symbol*);
+
+// This function is called to report an undefined symbol resulting
+// from a relocation. SYM is the undefined symbol. RELINFO is the
+// general relocation info. RELNUM is the number of the reloc,
+// and RELOFFSET is the reloc's offset.
template<int size, bool big_endian>
extern void
-gold_undefined_symbol(const Symbol*,
- const Relocate_info<size, big_endian>*,
- size_t, off_t);
+gold_undefined_symbol_at_location(const Symbol*,
+ const Relocate_info<size, big_endian>*,
+ size_t, off_t);
// This is function is called in some cases if we run out of memory.
extern void
gold_nomem() ATTRIBUTE_NORETURN;
+// In versions of gcc before 4.3, using __FUNCTION__ in a template
+// function can cause gcc to get confused about whether or not the
+// function can return. See http://gcc.gnu.org/PR30988. Use a macro
+// to avoid the problem. This can be removed when we no longer need
+// to care about gcc versions before 4.3.
+#if defined(__GNUC__) && GCC_VERSION < 4003
+#define FUNCTION_NAME static_cast<const char*>(__FUNCTION__)
+#else
+#define FUNCTION_NAME __FUNCTION__
+#endif
+
// This macro and function are used in cases which can not arise if
// the code is written correctly.
#define gold_unreachable() \
- (gold::do_gold_unreachable(__FILE__, __LINE__, __FUNCTION__))
+ (gold::do_gold_unreachable(__FILE__, __LINE__, FUNCTION_NAME))
extern void do_gold_unreachable(const char*, int, const char*)
ATTRIBUTE_NORETURN;
// Queue up the set of tasks to be done before
// the middle set of tasks. Only used when garbage
-// collection is to be done.
+// collection is to be done.
extern void
queue_middle_gc_tasks(const General_options&,
const Task*,