summaryrefslogtreecommitdiff
path: root/ld/ld.h
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-07-28 19:20:37 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-09-04 22:30:55 +0100
commitc005eb9e34ac08be0cd40e19a741d345bd43eab9 (patch)
treee161b0bf51e8b02bfc7e1c6e1cc5beb92fa86e4b /ld/ld.h
parente65b52456bc3f60a176fece5e34e420c5a75bd16 (diff)
ld: Extend options for altering orphan handling behaviour.
Replace the options --warn-orphan and --no-warn-orphan with a single option --orphan-handling=MODE, where mode can be place, warn, error, and discard. Mode 'place' is the default, and is the current behaviour, placing the orphan section into a suitable output section. Mode 'warn' is the same as '--warn-orphan'. The orphan is also placed using the same algorithm as for 'place'. Mode 'error' is the same as '--warn-orphan' and '--fatal-warnings'. Mode 'discard' assigns all output sections to the /DISCARD/ section. ld/ChangeLog: * ld.h (enum orphan_handling_enum): New. (ld_config_type): Remove warn_orphan, add orphan_handling. * ldemul.c (ldemul_place_orphan): Remove warning about orphan sections. * ldlang.c (ldlang_place_orphan): New function. (lang_place_orphans): Call ldlang_place_orphan. * ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING. * lexsup.c (ld_options): Remove 'warn-orphan' and 'no-warn-orphan', add 'orphan-handling'. (parse_args): Remove handling for OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING. * NEWS: Replace text about --warn-orphan with --orphan-handling. * ld.texinfo (Options): Remove --warn-orphan entry and add entry on --orphan-handling. (Orphan Sections): Add reference to relevant command line options. ld/testsuite/ChangeLog: * ld-elf/elf.exp: Switch to rely on run_dump_test. * ld-elf/orphan-5.l: Update expected output. * ld-elf/orphan-5.d: New file. * ld-elf/orphan-6.d: New file. * ld-elf/orphan-6.l: New file. * ld-elf/orphan-7.d: New file. * ld-elf/orphan-7.map: New file. * ld-elf/orphan-8.d: New file. * ld-elf/orphan-8.map: New file.
Diffstat (limited to 'ld/ld.h')
-rw-r--r--ld/ld.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/ld/ld.h b/ld/ld.h
index e6ebaae90f..d84ec4e634 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -207,6 +207,25 @@ extern args_type command_line;
typedef int token_code_type;
+/* Different ways we can handle orphan sections. */
+
+enum orphan_handling_enum {
+ /* The classic strategy, find a suitable section to place the orphan
+ into. */
+ orphan_handling_place = 0,
+
+ /* Discard any orphan sections as though they were assign to the section
+ /DISCARD/. */
+ orphan_handling_discard,
+
+ /* Find somewhere to place the orphan section, as with
+ ORPHAN_HANDLING_PLACE, but also issue a warning. */
+ orphan_handling_warn,
+
+ /* Issue a fatal error if any orphan sections are found. */
+ orphan_handling_error,
+};
+
typedef struct {
bfd_boolean magic_demand_paged;
bfd_boolean make_executable;
@@ -229,8 +248,8 @@ typedef struct {
/* If TRUE, only warn once about a particular undefined symbol. */
bfd_boolean warn_once;
- /* If TRUE, issue warning messages when orphan sections are encountered. */
- bfd_boolean warn_orphan;
+ /* How should we deal with orphan sections. */
+ enum orphan_handling_enum orphan_handling;
/* If TRUE, warn if multiple global-pointers are needed (Alpha
only). */