diff options
author | Ian Lance Taylor <iant@google.com> | 2007-10-23 05:05:48 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-10-23 05:05:48 +0000 |
commit | 35cdfc9a874553807400007ffa36cf2884ba40f6 (patch) | |
tree | 2cb1c5ca78a50b21d20e709d9d066fad27f1f6e5 /gold/options.cc | |
parent | 5cab6006497314f0d6785c5a5898be9f28713c72 (diff) | |
download | gdb-35cdfc9a874553807400007ffa36cf2884ba40f6.zip gdb-35cdfc9a874553807400007ffa36cf2884ba40f6.tar.gz gdb-35cdfc9a874553807400007ffa36cf2884ba40f6.tar.bz2 |
Add support for PT_GNU_STACK.
Diffstat (limited to 'gold/options.cc')
-rw-r--r-- | gold/options.cc | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/gold/options.cc b/gold/options.cc index 4e74dce..1e4b90e 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -93,11 +93,24 @@ struct options::One_option { return this->general_arg != NULL || this->dependent_arg != NULL; } }; +// We have a separate table for -z options. + +struct options::One_z_option +{ + // The name of the option. + const char* name; + + // The member function in General_options called to record it. + void (General_options::*set)(); +}; + class options::Command_line_options { public: static const One_option options[]; static const int options_size; + static const One_z_option z_options[]; + static const int z_options_size; }; } // End namespace gold. @@ -394,6 +407,14 @@ options::Command_line_options::options[] = N_("Include only needed archive contents"), NULL, TWO_DASHES, &Position_dependent_options::clear_whole_archive), + + GENERAL_ARG('z', NULL, + N_("Subcommands as follows:\n\ + -z execstack Mark output as requiring executable stack\n\ + -z noexecstack Mark output as not requiring executable stack"), + N_("-z SUBCOMMAND"), ONE_DASH, + &General_options::handle_z_option), + SPECIAL('(', "start-group", N_("Start a library search group"), NULL, TWO_DASHES, &start_group), SPECIAL(')', "end-group", N_("End a library search group"), NULL, @@ -407,6 +428,18 @@ options::Command_line_options::options[] = const int options::Command_line_options::options_size = sizeof (options) / sizeof (options[0]); +// The -z options. + +const options::One_z_option +options::Command_line_options::z_options[] = +{ + { "execstack", &General_options::set_execstack }, + { "noexecstack", &General_options::set_noexecstack }, +}; + +const int options::Command_line_options::z_options_size = + sizeof(z_options) / sizeof(z_options[0]); + // The default values for the general options. General_options::General_options() @@ -429,7 +462,8 @@ General_options::General_options() threads_(false), thread_count_initial_(0), thread_count_middle_(0), - thread_count_final_(0) + thread_count_final_(0), + execstack_(EXECSTACK_FROM_INPUT) { } @@ -442,6 +476,28 @@ Position_dependent_options::Position_dependent_options() { } +// Handle the -z option. + +void +General_options::handle_z_option(const char* arg) +{ + const int z_options_size = options::Command_line_options::z_options_size; + const gold::options::One_z_option* z_options = + gold::options::Command_line_options::z_options; + for (int i = 0; i < z_options_size; ++i) + { + if (strcmp(arg, z_options[i].name) == 0) + { + (this->*(z_options[i].set))(); + return; + } + } + + fprintf(stderr, _("%s: unrecognized -z subcommand: %s\n"), + program_name, arg); + ::exit(1); +} + // Add the sysroot, if any, to the search paths. void @@ -686,7 +742,7 @@ Command_line::process(int argc, char** argv) if (this->inputs_.in_group()) { - fprintf(stderr, _("%s: missing group end"), program_name); + fprintf(stderr, _("%s: missing group end\n"), program_name); this->usage(); } |