This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Gold patch committed: Add -Ttext-segment as an alias for -Ttext
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Fri, 15 Feb 2013 07:44:05 -0800
- Subject: Gold patch committed: Add -Ttext-segment as an alias for -Ttext
Gold's -Ttext option is approximately the same as GNU ld's
-Ttext-segment option. This patch adds -Ttext-segment to gold as an
alias for -Ttext, so that scripts can use both linkers the same way.
This was prompted in particular by
http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00699.html .
Ian
2013-02-15 Ian Lance Taylor <iant@google.com>
* options.h (DEFINE_uint64_alias): Define.
(class General_options): Add -Ttext-segment as an alias for
-Ttext.
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.183
diff -u -p -r1.183 options.h
--- options.h 24 Jan 2013 18:49:54 -0000 1.183
+++ options.h 15 Feb 2013 15:39:40 -0000
@@ -498,6 +498,32 @@ struct Struct_special : public Struct_va
}; \
Struct_no_##option__ no_##option__##_initializer_
+// This is like DEFINE_uint64, but VARNAME is the name of a different
+// option. This option becomes an alias for that one.
+#define DEFINE_uint64_alias(option__, varname__, dashes__, shortname__, \
+ helpstring__, helparg__) \
+ private: \
+ struct Struct_##option__ : public options::Struct_var \
+ { \
+ Struct_##option__() \
+ : option(#option__, dashes__, shortname__, "", helpstring__, \
+ helparg__, false, this) \
+ { } \
+ \
+ void \
+ parse_to_value(const char* option_name, const char* arg, \
+ Command_line*, General_options* options) \
+ { \
+ uint64_t value; \
+ options::parse_uint64(option_name, arg, &value); \
+ options->set_##varname__(value); \
+ options->set_user_set_##varname__(); \
+ } \
+ \
+ options::One_option option; \
+ }; \
+ Struct_##option__ option__##_;
+
// This is used for non-standard flags. It defines no functions; it
// just calls General_options::parse_VARNAME whenever the flag is
// seen. We declare parse_VARNAME as a static member of
@@ -1113,6 +1139,9 @@ class General_options
N_("Set the address of the data segment"), N_("ADDRESS"));
DEFINE_uint64(Ttext, options::ONE_DASH, '\0', -1U,
N_("Set the address of the text segment"), N_("ADDRESS"));
+ DEFINE_uint64_alias(Ttext_segment, Ttext, options::ONE_DASH, '\0',
+ N_("Set the address of the text segment"),
+ N_("ADDRESS"));
DEFINE_bool(toc_optimize, options::TWO_DASHES, '\0', true,
N_("(PowerPC64 only) Optimize TOC code sequences"),