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.
This commit is contained in:
Roland McGrath 2020-06-15 11:45:02 -07:00
parent 6692031743
commit cae64165f4
13 changed files with 103 additions and 7 deletions

View file

@ -542,10 +542,10 @@ struct bfd_link_info
Normally these optimizations are disabled by default but some targets
prefer to enable them by default. So this field is a tri-state variable.
The values are:
zero: Enable the optimizations (either from --relax being specified on
the command line or the backend's before_allocation emulation function.
positive: The user has requested that these optimizations be disabled.
(Via the --no-relax command line option).
@ -649,6 +649,9 @@ struct bfd_link_info
/* May be used to set DT_FLAGS_1 for ELF. */
bfd_vma flags_1;
/* May be used to set ELF visibility for __start_* / __stop_. */
unsigned int start_stop_visibility;
/* Start and end of RELRO region. */
bfd_vma relro_start, relro_end;