* options.h (class General_options): Add -z text and -z textoff.
authorIan Lance Taylor <ian@airs.com>
Thu, 7 Jan 2010 18:16:24 +0000 (18:16 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 7 Jan 2010 18:16:24 +0000 (18:16 +0000)
* layout.cc (Layout::finish_dynamic_section): Implement -z text.

gold/ChangeLog
gold/layout.cc
gold/options.h

index 65c0c9035a261e49521c55c5cab0a3984e999af6..43b5c08ee2ebfaaab2cdcf2e9795b3a9bb513335 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-07  Ian Lance Taylor  <iant@google.com>
+
+       * options.h (class General_options): Add -z text and -z textoff.
+       * layout.cc (Layout::finish_dynamic_section): Implement -z text.
+
 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
 
        * gc.h (Garbage_collection::Cident_section_map): New typedef.
index f427af5079da3b61839caa04ebf76ca243718497..9f51e82acfafef2196ab2005dd2b626453850eb7 100644 (file)
@@ -3353,8 +3353,10 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
       odyn->add_constant(elfcpp::DT_TEXTREL, 0);
       flags |= elfcpp::DF_TEXTREL;
 
-      if (parameters->options().warn_shared_textrel()
-         && parameters->options().shared())
+      if (parameters->options().text())
+       gold_error(_("read-only segment has dynamic relocations"));
+      else if (parameters->options().warn_shared_textrel()
+              && parameters->options().shared())
        gold_warning(_("shared library text segment is not shareable"));
     }
   if (parameters->options().shared() && this->has_static_tls())
index 110b91f8133d484eaae8ef96d984f6ca1367896e..de1f07a43fff009b7b7beee6b2a5b89eb18ae126 100644 (file)
@@ -1052,6 +1052,12 @@ class General_options
   DEFINE_bool(relro, options::DASH_Z, '\0', false,
              N_("Where possible mark variables read-only after relocation"),
              N_("Don't mark variables read-only after relocation"));
+  DEFINE_bool(text, options::DASH_Z, '\0', false,
+             N_("Do not permit relocations in read-only segments"),
+             NULL);
+  DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0',
+                   N_("Permit relocations in read-only segments (default)"),
+                   NULL, true);
 
  public:
   typedef options::Dir_list Dir_list;