aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index fea056d..e4eda44 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -70,7 +70,8 @@ Layout::Layout(const General_options& options)
eh_frame_section_(NULL), output_file_size_(-1),
input_requires_executable_stack_(false),
input_with_gnu_stack_note_(false),
- input_without_gnu_stack_note_(false)
+ input_without_gnu_stack_note_(false),
+ have_textrel_(false)
{
// Make space for more than enough segments for a typical file.
// This is just for efficiency--it's OK if we wind up needing more.
@@ -1582,6 +1583,13 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
odyn->add_string(elfcpp::DT_RPATH, rpath_val);
}
+
+ // Add a DT_FLAGS entry. We add it even if no flags are set so that
+ // post-link tools can easily modify these flags if desired.
+ unsigned int flags = 0;
+ if (this->have_textrel_)
+ flags |= elfcpp::DF_TEXTREL;
+ odyn->add_constant(elfcpp::DT_FLAGS, flags);
}
// The mapping of .gnu.linkonce section names to real section names.