summaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorRoland McGrath <mcgrathr@google.com>2020-06-12 23:52:57 -0700
committerRoland McGrath <mcgrathr@google.com>2020-06-12 23:52:57 -0700
commit9242996ba250d0411efe6b00ee9a9893081d9137 (patch)
tree2d20f848d72886f5e8297c6b056a38c0952292bc /gold/layout.cc
parent10059956eef2a85e0992d1df3aca304d380d0c43 (diff)
downloadbinutils-gdb-users/roland/ld-start-stop-visibility.tar.gz
gold, ld: Implement -z start-stop-visibility=... option.users/roland/ld-start-stop-visibility
gold/ * options.h (class General_options): Handle -z start-stop-visibility=. (General_options::start_stop_visibility): New public method. (General_options::start_stop_visibility_): New private member. * options.cc (General_options::General_options): Add initializer. (General_options::parse_start_stop_visibility): New function. * layout.cc (Layout::define_section_symbols): Use option setting. bfd/ * elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility field of bfd_link_info. include/ * bfdlink.h (struct bfd_link_info): New field start_stop_visibility. ld/ * NEWS: Mention -z start-stop-visibility=... option for ELF. * ld.texi (Options): Document -z start-stop-visibility=... option. * ldmain.c (main): Initialize link_info.start_stop_visibility. * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Parse -z start-stop-visibility=... option.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index be437f3900e..bb7fd497b42 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -2474,6 +2474,7 @@ Layout::create_initial_dynamic_sections(Symbol_table* symtab)
void
Layout::define_section_symbols(Symbol_table* symtab)
{
+ const elfcpp::STV visibility = parameters->options().start_stop_visibility();
for (Section_list::const_iterator p = this->section_list_.begin();
p != this->section_list_.end();
++p)
@@ -2495,7 +2496,7 @@ Layout::define_section_symbols(Symbol_table* symtab)
0, // symsize
elfcpp::STT_NOTYPE,
elfcpp::STB_GLOBAL,
- elfcpp::STV_PROTECTED,
+ visibility,
0, // nonvis
false, // offset_is_from_end
true); // only_if_ref
@@ -2508,7 +2509,7 @@ Layout::define_section_symbols(Symbol_table* symtab)
0, // symsize
elfcpp::STT_NOTYPE,
elfcpp::STB_GLOBAL,
- elfcpp::STV_PROTECTED,
+ visibility,
0, // nonvis
true, // offset_is_from_end
true); // only_if_ref