summaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-12-13 13:01:13 -0800
committerCary Coutant <ccoutant@gmail.com>2016-12-13 13:01:26 -0800
commit591be3e4a841ac56bb3ee094447b708d58a6d4b8 (patch)
tree9ef4c58b0530d20a799cb095554656a2cad35c6a /gold/options.cc
parent03fb64f837bd8466ba6e7b7cb8880f5c6c87daab (diff)
downloadbinutils-gdb-591be3e4a841ac56bb3ee094447b708d58a6d4b8.tar.gz
Add --orphan-handling option.
gold/ PR gold/20749 * options.h (--orphan-handling): New option. (General_options::Orphan_handling): New enum. (General_options::orphan_handling_enum): New method. (General_options::set_orphan_handling_enum): New method. (General_options::orphan_handling_enum_): New data member. * options.cc (General_options::General_options): Initialize new member. (General_options::finalize): Convert --orphan-handling argument to enum. * script-sections.cc (Script_sections::output_section_name): Check it.
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/gold/options.cc b/gold/options.cc
index 276be39e470..1650910326c 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -998,7 +998,8 @@ General_options::General_options()
section_starts_(),
fix_v4bx_(FIX_V4BX_NONE),
endianness_(ENDIANNESS_NOT_SET),
- discard_locals_(DISCARD_SEC_MERGE)
+ discard_locals_(DISCARD_SEC_MERGE),
+ orphan_handling_enum_(ORPHAN_PLACE)
{
// Turn off option registration once construction is complete.
gold::options::ready_to_register = false;
@@ -1157,6 +1158,19 @@ General_options::finalize()
this->set_do_demangle(getenv("COLLECT_NO_DEMANGLE") == NULL);
}
+ // Parse the --orphan-handling argument.
+ if (this->user_set_orphan_handling())
+ {
+ if (strcmp(this->orphan_handling(), "place") == 0)
+ this->set_orphan_handling_enum(ORPHAN_PLACE);
+ else if (strcmp(this->orphan_handling(), "discard") == 0)
+ this->set_orphan_handling_enum(ORPHAN_DISCARD);
+ else if (strcmp(this->orphan_handling(), "warn") == 0)
+ this->set_orphan_handling_enum(ORPHAN_WARN);
+ else if (strcmp(this->orphan_handling(), "error") == 0)
+ this->set_orphan_handling_enum(ORPHAN_ERROR);
+ }
+
// -M is equivalent to "-Map -".
if (this->print_map() && !this->user_set_Map())
{