From cae64165f47b64898c4f1982d294862cfae89a47 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 15 Jun 2020 11:45:02 -0700 Subject: 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. --- ld/ChangeLog | 8 ++++++++ ld/NEWS | 3 +++ ld/emultempl/elf.em | 15 +++++++++++++++ ld/ld.texi | 13 +++++++++++++ ld/ldmain.c | 2 ++ 5 files changed, 41 insertions(+) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index c6de044..6700e72 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2020-06-15 Roland McGrath + + * 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. + 2020-06-15 Alan Modra * testsuite/ld-scripts/include.exp: Don't load ld-lib.exp. diff --git a/ld/NEWS b/ld/NEWS index 485e1cf..6955937 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -25,6 +25,9 @@ searched relative to the directory of the linker script before other search paths. +* Add ELF linker command-line option `-z start-stop-visibility=...' to control + the visibility of synthetic `__start_SECNAME` and `__stop_SECNAME` symbols. + Changes in 2.34: * The ld check for "PHDR segment not covered by LOAD segment" is more diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index c4979eb..c577e8b 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -749,6 +749,21 @@ fragment <