aboutsummaryrefslogtreecommitdiff
path: root/gold/gold.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-12-18 00:48:04 +0000
committerIan Lance Taylor <iant@google.com>2007-12-18 00:48:04 +0000
commit8383303e0acce6e4332e2a2097b832e2deb880ec (patch)
tree6ccbc99caa33528817ffef492de98dfd19262563 /gold/gold.h
parent3d372cd7a1b4639eed8fc062829a97b67a1342bf (diff)
downloadfsf-binutils-gdb-8383303e0acce6e4332e2a2097b832e2deb880ec.zip
fsf-binutils-gdb-8383303e0acce6e4332e2a2097b832e2deb880ec.tar.gz
fsf-binutils-gdb-8383303e0acce6e4332e2a2097b832e2deb880ec.tar.bz2
Add section_size_type and section_offset_type, use them to replace a
lot of instances of off_t.
Diffstat (limited to 'gold/gold.h')
-rw-r--r--gold/gold.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/gold/gold.h b/gold/gold.h
index 32fcc43..8ea24d2 100644
--- a/gold/gold.h
+++ b/gold/gold.h
@@ -161,10 +161,7 @@ class Select_size_endian { };
#endif // !defined(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS)
-} // End namespace gold.
-
-namespace gold
-{
+// General declarations.
class General_options;
class Command_line;
@@ -180,6 +177,17 @@ class Output_file;
template<int size, bool big_endian>
struct Relocate_info;
+// Some basic types. For these we use lower case initial letters.
+
+// For an offset in an input or output file, use off_t. Note that
+// this will often be a 64-bit type even for a 32-bit build.
+
+// The size of a section if we are going to look at the contents.
+typedef size_t section_size_type;
+
+// An offset within a section when we are looking at the contents.
+typedef ptrdiff_t section_offset_type;
+
// The name of the program as used in error messages.
extern const char* program_name;
@@ -250,6 +258,22 @@ print_version(bool print_short);
extern const char*
get_version_string();
+// Convert numeric types without unnoticed loss of precision.
+template<typename To, typename From>
+inline To
+convert_types(const From from)
+{
+ To to = from;
+ gold_assert(to == from);
+ return to;
+}
+
+// A common case of convert_types<>: convert to section_size_type.
+template<typename From>
+inline section_size_type
+convert_to_section_size_type(const From from)
+{ return convert_types<section_size_type, From>(from); }
+
// Queue up the first set of tasks.
extern void
queue_initial_tasks(const General_options&,