diff options
author | Roland McGrath <mcgrathr@google.com> | 2020-06-15 11:45:02 -0700 |
---|---|---|
committer | Roland McGrath <mcgrathr@google.com> | 2020-06-15 11:45:02 -0700 |
commit | cae64165f47b64898c4f1982d294862cfae89a47 (patch) | |
tree | d51ade829ba19bebf17822647e08d49506d534b8 /gold/options.cc | |
parent | 669203174311c5be76744a879563c697cd479853 (diff) | |
download | gdb-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.cc')
-rw-r--r-- | gold/options.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gold/options.cc b/gold/options.cc index 94867b3..b13ae71 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -997,7 +997,8 @@ General_options::General_options() fix_v4bx_(FIX_V4BX_NONE), endianness_(ENDIANNESS_NOT_SET), discard_locals_(DISCARD_SEC_MERGE), - orphan_handling_enum_(ORPHAN_PLACE) + orphan_handling_enum_(ORPHAN_PLACE), + start_stop_visibility_enum_(elfcpp::STV_PROTECTED) { // Turn off option registration once construction is complete. gold::options::ready_to_register = false; @@ -1169,6 +1170,19 @@ General_options::finalize() this->set_orphan_handling_enum(ORPHAN_ERROR); } + // Parse the -z start-stop-visibility argument. + if (this->user_set_start_stop_visibility()) + { + if (strcmp(this->start_stop_visibility(), "default") == 0) + this->set_start_stop_visibility_enum(elfcpp::STV_DEFAULT); + else if (strcmp(this->start_stop_visibility(), "internal") == 0) + this->set_start_stop_visibility_enum(elfcpp::STV_INTERNAL); + else if (strcmp(this->start_stop_visibility(), "hidden") == 0) + this->set_start_stop_visibility_enum(elfcpp::STV_HIDDEN); + else if (strcmp(this->start_stop_visibility(), "protected") == 0) + this->set_start_stop_visibility_enum(elfcpp::STV_PROTECTED); + } + // -M is equivalent to "-Map -". if (this->print_map() && !this->user_set_Map()) { |