aboutsummaryrefslogtreecommitdiff
path: root/gold/options.h
diff options
context:
space:
mode:
authorRoland McGrath <mcgrathr@google.com>2020-06-15 11:45:02 -0700
committerRoland McGrath <mcgrathr@google.com>2020-06-15 11:45:02 -0700
commitcae64165f47b64898c4f1982d294862cfae89a47 (patch)
treed51ade829ba19bebf17822647e08d49506d534b8 /gold/options.h
parent669203174311c5be76744a879563c697cd479853 (diff)
downloadgdb-cae64165f47b64898c4f1982d294862cfae89a47.zip
gdb-cae64165f47b64898c4f1982d294862cfae89a47.tar.gz
gdb-cae64165f47b64898c4f1982d294862cfae89a47.tar.bz2
gold, ld: Implement -z start-stop-visibility=... option.
gold/ Implement -z start-stop-visibility=... option. * options.h (class General_options): Handle -z start-stop-visibility=. (General_options::start_stop_visibility_enum): New public method. (General_options::set_start_stop_visibility_enum): New private method. (General_options::start_stop_visibility_enum_): New private member. * options.cc (General_options::General_options): Add initializer. (General_options::finalize): Set this->start_stop_visibility_enum_ from string value. * 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/options.h')
-rw-r--r--gold/options.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gold/options.h b/gold/options.h
index b2059d9..f0e9fbd 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1500,6 +1500,11 @@ class General_options
N_("Don't mark variables read-only after relocation"));
DEFINE_uint64(stack_size, options::DASH_Z, '\0', 0,
N_("Set PT_GNU_STACK segment p_memsz to SIZE"), N_("SIZE"));
+ DEFINE_enum(start_stop_visibility, options::DASH_Z, '\0', "protected",
+ N_("ELF symbol visibility for synthesized "
+ "__start_* and __stop_* symbols"),
+ ("[default,internal,hidden,protected]"),
+ {"default", "internal", "hidden", "protected"});
DEFINE_bool(text, options::DASH_Z, '\0', false,
N_("Do not permit relocations in read-only segments"),
N_("Permit relocations in read-only segments"));
@@ -1750,6 +1755,10 @@ class General_options
orphan_handling_enum() const
{ return this->orphan_handling_enum_; }
+ elfcpp::STV
+ start_stop_visibility_enum() const
+ { return this->start_stop_visibility_enum_; }
+
private:
// Don't copy this structure.
General_options(const General_options&);
@@ -1809,6 +1818,10 @@ class General_options
set_orphan_handling_enum(Orphan_handling value)
{ this->orphan_handling_enum_ = value; }
+ void
+ set_start_stop_visibility_enum(elfcpp::STV value)
+ { this->start_stop_visibility_enum_ = value; }
+
// These are called by finalize() to set up the search-path correctly.
void
add_to_library_path_with_sysroot(const std::string& arg)
@@ -1876,6 +1889,8 @@ class General_options
std::vector<Position_dependent_options*> options_stack_;
// Orphan handling option, decoded to an enum value.
Orphan_handling orphan_handling_enum_;
+ // Symbol visibility for __start_* / __stop_* magic symbols.
+ elfcpp::STV start_stop_visibility_enum_;
};
// The position-dependent options. We use this to store the state of