2009-04-23 Chris Demetriou <cgd@google.com>
[deliverable/binutils-gdb.git] / gold / gold.h
index 63df9942ffdbbd8ed51a21787b8005fb9e618945..efebda8a36670cdae8aba514378f7daa9d2bdaca 100644 (file)
@@ -1,6 +1,6 @@
 // gold.h -- general definitions for gold   -*- C++ -*-
 
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -27,6 +27,8 @@
 #include "ansidecl.h"
 
 #include <cstddef>
+#include <cstring>
+#include <stdint.h>
 #include <sys/types.h>
 
 #ifndef ENABLE_NLS
@@ -63,7 +65,8 @@
 
 // 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>
@@ -73,6 +76,8 @@
 #define Unordered_set std::tr1::unordered_set
 #define Unordered_map std::tr1::unordered_map
 
+#define reserve_unordered_map(map, n) ((map)->rehash(n))
+
 #elif defined(HAVE_EXT_HASH_MAP) && defined(HAVE_EXT_HASH_SET)
 
 #include <ext/hash_map>
@@ -103,6 +108,8 @@ struct hash<T*>
 
 }
 
+#define reserve_unordered_map(map, n) ((map)->resize(n))
+
 #else
 
 // The fallback is to just use set and map.
@@ -113,12 +120,27 @@ struct hash<T*>
 #define Unordered_set std::set
 #define Unordered_map std::map
 
+#define reserve_unordered_map(map, n)
+
 #endif
 
 #ifndef HAVE_PREAD
 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
+
 namespace gold
 {
 
@@ -200,12 +222,22 @@ gold_warning_at_location(const Relocate_info<size, big_endian>*,
                         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
@@ -259,6 +291,18 @@ queue_initial_tasks(const General_options&,
                    Layout*,
                    Mapfile*);
 
+// Queue up the set of tasks to be done before
+// the middle set of tasks.  Only used when garbage
+// collection is to be done. 
+extern void
+queue_middle_gc_tasks(const General_options&,
+                      const Task*,
+                      const Input_objects*,
+                      Symbol_table*,
+                      Layout*,
+                      Workqueue*,
+                      Mapfile*);
+
 // Queue up the middle set of tasks.
 extern void
 queue_middle_tasks(const General_options&,
@@ -278,6 +322,12 @@ queue_final_tasks(const General_options&,
                  Workqueue*,
                  Output_file* of);
 
+inline bool
+is_prefix_of(const char* prefix, const char* str)
+{
+  return strncmp(prefix, str, strlen(prefix)) == 0;
+}
+
 } // End namespace gold.
 
 #endif // !defined(GOLD_GOLD_H)
This page took 0.024143 seconds and 4 git commands to generate.