aboutsummaryrefslogtreecommitdiff
path: root/gold/options.h
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.h
parent03fb64f837bd8466ba6e7b7cb8880f5c6c87daab (diff)
downloadbinutils-591be3e4a841ac56bb3ee094447b708d58a6d4b8.zip
binutils-591be3e4a841ac56bb3ee094447b708d58a6d4b8.tar.gz
binutils-591be3e4a841ac56bb3ee094447b708d58a6d4b8.tar.bz2
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.h')
-rw-r--r--gold/options.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/gold/options.h b/gold/options.h
index 75b2f09..ebe08df 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1072,6 +1072,10 @@ class General_options
DEFINE_uint(optimize, options::EXACTLY_ONE_DASH, 'O', 0,
N_("Optimize output file size"), N_("LEVEL"));
+ DEFINE_enum(orphan_handling, options::TWO_DASHES, '\0', "place",
+ N_("Orphan section handling"), N_("[place,discard,warn,error]"),
+ {"place", "discard", "warn", "error"});
+
// p
DEFINE_bool(p, options::ONE_DASH, 'p', false,
@@ -1684,6 +1688,22 @@ class General_options
discard_sec_merge() const
{ return this->discard_locals_ == DISCARD_SEC_MERGE; }
+ enum Orphan_handling
+ {
+ // Place orphan sections normally (default).
+ ORPHAN_PLACE,
+ // Discard all orphan sections.
+ ORPHAN_DISCARD,
+ // Warn when placing orphan sections.
+ ORPHAN_WARN,
+ // Issue error for orphan sections.
+ ORPHAN_ERROR
+ };
+
+ Orphan_handling
+ orphan_handling_enum() const
+ { return this->orphan_handling_enum_; }
+
private:
// Don't copy this structure.
General_options(const General_options&);
@@ -1739,6 +1759,10 @@ class General_options
set_static(bool value)
{ static_ = value; }
+ void
+ set_orphan_handling_enum(Orphan_handling value)
+ { this->orphan_handling_enum_ = value; }
+
// These are called by finalize() to set up the search-path correctly.
void
add_to_library_path_with_sysroot(const std::string& arg)
@@ -1804,6 +1828,8 @@ class General_options
Discard_locals discard_locals_;
// Stack of saved options for --push-state/--pop-state.
std::vector<Position_dependent_options*> options_stack_;
+ // Orphan handling option, decoded to an enum value.
+ Orphan_handling orphan_handling_enum_;
};
// The position-dependent options. We use this to store the state of