ld: Add "-z separate-code" option to ELF linker

The new "-z separate-code" option will generate separate code LOAD
segment which must be in wholly disjoint pages from any other data.

include/

	PR ld/22393
	* bfdlink.h (bfd_link_info): Add separate_code.

ld/

	PR ld/22393
	* NEWS: Mention "-z separate-code".
	* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Get
	builtin linker scripts and return linker scripts from disk for
	"-z separate-code".
	(gld${EMULATION_NAME}_handle_option): Handle "-z separate-code"
	and "-z noseparate-code".
	* genscripts.sh: Generate linker scripts for "-z separate-code".
	(LD_FLAG): Set to *textonly for "-z separate-code".
	* ld.texinfo: Document "-z separate-code".
	* lexsup.c (elf_shlib_list_options): Add linker help messsages
	for "-z separate-code" and "-z noseparate-code".
	* scripttempl/elf.sc (SEPARATE_TEXT): New
	(TEXT_SEGMENT_ALIGN): Likewise.
	Use ${TEXT_SEGMENT_ALIGN} to align and pad text segment to
	${MAXPAGESIZE}.
This commit is contained in:
H.J. Lu
2018-01-11 19:01:39 -08:00
parent 6181e9c2c5
commit 47acac12c8
9 changed files with 218 additions and 20 deletions

View File

@@ -1787,6 +1787,10 @@ elf_shlib_list_options (FILE *file)
fprintf (file, _("\
-z norelro Don't create RELRO program header (default)\n"));
#endif
fprintf (file, _("\
-z separate-code Create separate code program header\n"));
fprintf (file, _("\
-z noseparate-code Don't create separate code program header (default)\n"));
fprintf (file, _("\
-z common Generate common symbols with STT_COMMON type\n"));
fprintf (file, _("\