PR 10980
authorIan Lance Taylor <ian@airs.com>
Thu, 7 Jan 2010 06:05:23 +0000 (06:05 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 7 Jan 2010 06:05:23 +0000 (06:05 +0000)
* options.h (class General_options): Add --warn-shared-textrel.
* layout.cc (Layout::finish_dynamic_section): Implement
--warn-shared-textrel.

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

index c759683765577f2354d7b85ff378ee426ec40d10..b52505ff8d7acacda58fb806b69a5bae5743f1be 100644 (file)
@@ -1,5 +1,10 @@
 2010-01-06  Ian Lance Taylor  <iant@google.com>
 
+       PR 10980
+       * options.h (class General_options): Add --warn-shared-textrel.
+       * layout.cc (Layout::finish_dynamic_section): Implement
+       --warn-shared-textrel.
+
        PR 10980
        * options.h (class General_options): Add --warn-multiple-gp.
 
index 13c7f7eab0d7d7b1836a4316951ee2917b2bb117..f3deb9aa3e4b3d2cce47515e25aec45f331eefa3 100644 (file)
@@ -3355,6 +3355,10 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
       // Add a DT_TEXTREL for compatibility with older loaders.
       odyn->add_constant(elfcpp::DT_TEXTREL, 0);
       flags |= elfcpp::DF_TEXTREL;
+
+      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())
     flags |= elfcpp::DF_STATIC_TLS;
index 018ec1b50558f17e144ba238a14e99153fa2e0f8..110b91f8133d484eaae8ef96d984f6ca1367896e 100644 (file)
@@ -968,6 +968,10 @@ class General_options
              N_("Warn when skipping an incompatible library"),
              N_("Don't warn when skipping an incompatible library"));
 
+  DEFINE_bool(warn_shared_textrel, options::TWO_DASHES, '\0', false,
+             N_("Warn if text segment is not shareable"),
+             N_("Do not warn if text segment is not shareable (default)"));
+
   DEFINE_bool(whole_archive, options::TWO_DASHES, '\0', false,
               N_("Include all archive contents"),
               N_("Include only needed archive contents"));