// 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.
#include "config.h"
#include "ansidecl.h"
+#include <cstddef>
+#include <cstring>
+#include <stdint.h>
+#include <sys/types.h>
+
+#ifndef ENABLE_NLS
+ // The Solaris version of locale.h always includes libintl.h. If we
+ // have been configured with --disable-nls then ENABLE_NLS will not
+ // be defined and the dummy definitions of bindtextdomain (et al)
+ // below will conflict with the defintions in libintl.h. So we
+ // define these values to prevent the bogus inclusion of libintl.h.
+# define _LIBINTL_H
+# define _LIBGETTEXT_H
+#endif
+
+// Always include <clocale> first to avoid conflicts with the macros
+// used when ENABLE_NLS is not defined.
+#include <clocale>
+
#ifdef ENABLE_NLS
# include <libintl.h>
# define _(String) gettext (String)
class Input_argument_list;
class Dirsearch;
class Input_objects;
+class Mapfile;
class Symbol;
class Symbol_table;
class Layout;
extern void
gold_warning(const char* msg, ...) ATTRIBUTE_PRINTF_1;
+// This function is called to print an informational message.
+extern void
+gold_info(const char* msg, ...) ATTRIBUTE_PRINTF_1;
+
+// Work around a bug in gcc 4.3.0. http://gcc.gnu.org/PR35546 . This
+// can probably be removed after the bug has been fixed for a while.
+#ifdef HAVE_TEMPLATE_ATTRIBUTES
+#define TEMPLATE_ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF_4
+#else
+#define TEMPLATE_ATTRIBUTE_PRINTF_4
+#endif
+
// This function is called to issue an error at the location of a
// reloc.
template<int size, bool big_endian>
extern void
gold_error_at_location(const Relocate_info<size, big_endian>*,
size_t, off_t, const char* format, ...)
- ATTRIBUTE_PRINTF_4;
+ TEMPLATE_ATTRIBUTE_PRINTF_4;
// This function is called to issue a warning at the location of a
// reloc.
extern void
gold_warning_at_location(const Relocate_info<size, big_endian>*,
size_t, off_t, const char* format, ...)
- ATTRIBUTE_PRINTF_4;
+ 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
Workqueue*,
Input_objects*,
Symbol_table*,
- Layout*);
+ 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
const Input_objects*,
Symbol_table*,
Layout*,
- Workqueue*);
+ Workqueue*,
+ Mapfile*);
// Queue up the final set of tasks.
extern void
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)