aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2008-04-16 23:21:01 +0000
committerDavid S. Miller <davem@redhat.com>2008-04-16 23:21:01 +0000
commit7c41443585981fab8c7b9d375df49b9f8c779b5d (patch)
tree53a76409ab731fe4b602c6ac9d3f1bcb439adca7 /gold
parentdacec2a8bd47e90428f29f32d55ecb243e1d9ecd (diff)
downloadgdb-7c41443585981fab8c7b9d375df49b9f8c779b5d.zip
gdb-7c41443585981fab8c7b9d375df49b9f8c779b5d.tar.gz
gdb-7c41443585981fab8c7b9d375df49b9f8c779b5d.tar.bz2
elfcpp/
* elfcpp.h (DF_1_NOW, DF_1_GLOBAL, DF_1_GROUP, DF_1_NODELETE, DF_1_LOADFLTR, DF_1_INITFIRST, DF_1_NOOPEN, DF_1_ORIGIN, DF_1_DIRECT, DF_1_TRANS, DF_1_INTERPOSE, DF_1_NODEFLIB, DF_1_NODUMP, DF_1_CONLFAT): New enum constants. gold/ * options.h (DEFINE_enable): New macro. (new_dtags): New enable option. (initfirst, interpose, loadfltr, nodefaultlib, nodelete, nodlopen, nodump): New -z options. * layout.cc (Layout:finish_dynamic_section): If new dtags enabled, emit DT_RUNPATH. Also, emit a DT_FLAGS_1 containing any specified -z flags.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/layout.cc24
-rw-r--r--gold/options.h47
3 files changed, 81 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 4d1a250..7a34ffe 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,13 @@
+2008-04-16 David S. Miller <davem@davemloft.net>
+
+ * options.h (DEFINE_enable): New macro.
+ (new_dtags): New enable option.
+ (initfirst, interpose, loadfltr, nodefaultlib,
+ nodelete, nodlopen, nodump): New -z options.
+ * layout.cc (Layout:finish_dynamic_section): If new
+ dtags enabled, emit DT_RUNPATH. Also, emit a
+ DT_FLAGS_1 containing any specified -z flags.
+
2008-04-16 Ian Lance Taylor <iant@google.com>
* copy-relocs.cc: New file.
diff --git a/gold/layout.cc b/gold/layout.cc
index 76b6b2b..fa0d4c8 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -2459,6 +2459,8 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
}
odyn->add_string(elfcpp::DT_RPATH, rpath_val);
+ if (parameters->options().enable_new_dtags())
+ odyn->add_string(elfcpp::DT_RUNPATH, rpath_val);
}
// Look for text segments that have dynamic relocations.
@@ -2509,6 +2511,28 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
if (parameters->options().shared() && this->has_static_tls())
flags |= elfcpp::DF_STATIC_TLS;
odyn->add_constant(elfcpp::DT_FLAGS, flags);
+
+ flags = 0;
+ if (parameters->options().initfirst())
+ flags |= elfcpp::DF_1_INITFIRST;
+ if (parameters->options().interpose())
+ flags |= elfcpp::DF_1_INTERPOSE;
+ if (parameters->options().loadfltr())
+ flags |= elfcpp::DF_1_LOADFLTR;
+ if (parameters->options().nodefaultlib())
+ flags |= elfcpp::DF_1_NODEFLIB;
+ if (parameters->options().nodelete())
+ flags |= elfcpp::DF_1_NODELETE;
+ if (parameters->options().nodlopen())
+ flags |= elfcpp::DF_1_NOOPEN;
+ if (parameters->options().nodump())
+ flags |= elfcpp::DF_1_NODUMP;
+ if (!parameters->options().shared())
+ flags &= ~(elfcpp::DF_1_INITFIRST
+ | elfcpp::DF_1_NODELETE
+ | elfcpp::DF_1_NOOPEN);
+ if (flags)
+ odyn->add_constant(elfcpp::DT_FLAGS_1, flags);
}
// The mapping of .gnu.linkonce section names to real section names.
diff --git a/gold/options.h b/gold/options.h
index e17c40f..2c71fae 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -286,6 +286,28 @@ struct Struct_special : public Struct_var
}; \
Struct_no_##varname__ no_##varname__##_initializer_
+#define DEFINE_enable(varname__, dashes__, shortname__, default_value__, \
+ helpstring__, no_helpstring__) \
+ DEFINE_var(enable_##varname__, dashes__, shortname__, default_value__, \
+ default_value__ ? "true" : "false", helpstring__, NULL, \
+ false, bool, bool, options::parse_bool) \
+ struct Struct_disable_##varname__ : public options::Struct_var \
+ { \
+ Struct_disable_##varname__() : option("disable-" #varname__, \
+ dashes__, '\0', \
+ default_value__ ? "false" : "true", \
+ no_helpstring__, NULL, false, this) \
+ { } \
+ \
+ void \
+ parse_to_value(const char*, const char*, \
+ Command_line*, General_options* options) \
+ { options->set_enable_##varname__(false); } \
+ \
+ options::One_option option; \
+ }; \
+ Struct_disable_##varname__ disable_##varname__##_initializer_
+
#define DEFINE_uint(varname__, dashes__, shortname__, default_value__, \
helpstring__, helparg__) \
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
@@ -538,6 +560,10 @@ class General_options
DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
N_("Ignored for compatibility"), N_("EMULATION"));
+ DEFINE_enable(new_dtags, options::EXACTLY_TWO_DASHES, '\0', false,
+ N_("Enable use of DT_RUNPATH and DT_FLAGS"),
+ N_("Disable use of DT_RUNPATH and DT_FLAGS"));
+
DEFINE_bool(noinhibit_exec, options::TWO_DASHES, '\0', false,
N_("Create an output file even if errors occur"), NULL);
@@ -653,6 +679,27 @@ class General_options
N_("Set maximum page size to SIZE"), N_("SIZE"));
DEFINE_bool(noexecstack, options::DASH_Z, '\0', false,
N_("Mark output as not requiring executable stack"), NULL);
+ DEFINE_bool(initfirst, options::DASH_Z, '\0', false,
+ N_("Mark DSO to be initialized first at runtime"),
+ NULL);
+ DEFINE_bool(interpose, options::DASH_Z, '\0', false,
+ N_("Mark object to interpose all DSOs but executable"),
+ NULL);
+ DEFINE_bool(loadfltr, options::DASH_Z, '\0', false,
+ N_("Mark object requiring immediate process"),
+ NULL);
+ DEFINE_bool(nodefaultlib, options::DASH_Z, '\0', false,
+ N_("Mark object not to use default search paths"),
+ NULL);
+ DEFINE_bool(nodelete, options::DASH_Z, '\0', false,
+ N_("Mark DSO non-deletable at runtime"),
+ NULL);
+ DEFINE_bool(nodlopen, options::DASH_Z, '\0', false,
+ N_("Mark DSO not available to dlopen"),
+ NULL);
+ DEFINE_bool(nodump, options::DASH_Z, '\0', false,
+ N_("Mark DSO not available to dldump"),
+ NULL);
public:
typedef options::Dir_list Dir_list;