From Craig Silverstein: don't permit -s and -r.

This commit is contained in:
Ian Lance Taylor 2007-10-10 19:30:39 +00:00
parent 86f26d2fc3
commit 46738c9aeb
3 changed files with 95 additions and 60 deletions

View File

@ -654,8 +654,28 @@ Command_line::process(int argc, char** argv)
this->options_.add_to_search_path_with_sysroot("/usr/lib"); this->options_.add_to_search_path_with_sysroot("/usr/lib");
this->options_.add_sysroot(); this->options_.add_sysroot();
// Ensure options don't contradict each other and are otherwise kosher.
this->normalize_options();
} }
// Ensure options don't contradict each other and are otherwise kosher.
void
Command_line::normalize_options()
{
// If the user specifies both -s and -r, convert the -s as -S.
// -r requires us to keep externally visible symbols!
if (this->options_.strip_all() && this->options_.is_relocatable())
{
// Clears the strip_all() status, replacing it with strip_debug().
this->options_.set_strip_debug();
}
// FIXME: we can/should be doing a lot more sanity checking here.
}
// Apply a command line option. // Apply a command line option.
void void

View File

@ -225,6 +225,8 @@ class General_options
set_strip_all() set_strip_all()
{ this->strip_ = STRIP_ALL; } { this->strip_ = STRIP_ALL; }
// Note: normalize_options() depends on the fact that this turns off
// STRIP_ALL if it were already set.
void void
set_strip_debug() set_strip_debug()
{ this->strip_ = STRIP_DEBUG; } { this->strip_ = STRIP_DEBUG; }
@ -587,6 +589,11 @@ class Command_line
void void
add_file(const char* name, bool is_lib); add_file(const char* name, bool is_lib);
// Examine the result of processing the command-line, and verify
// the flags do not contradict each other or are otherwise illegal.
void
normalize_options();
General_options options_; General_options options_;
Position_dependent_options position_options_; Position_dependent_options position_options_;
Input_arguments inputs_; Input_arguments inputs_;

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-10-07 22:11-0700\n" "POT-Creation-Date: 2007-10-10 12:27-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -106,7 +106,7 @@ msgstr ""
msgid "%s: %s: dynamic symbol table name section has wrong type: %u\n" msgid "%s: %s: dynamic symbol table name section has wrong type: %u\n"
msgstr "" msgstr ""
#: dynobj.cc:390 object.cc:440 #: dynobj.cc:390 object.cc:441
#, c-format #, c-format
msgid "%s: %s: bad section name offset for section %u: %lu\n" msgid "%s: %s: bad section name offset for section %u: %lu\n"
msgstr "" msgstr ""
@ -206,17 +206,17 @@ msgstr ""
msgid "%s: %s: mmap offset %lld size %lld failed: %s\n" msgid "%s: %s: mmap offset %lld size %lld failed: %s\n"
msgstr "" msgstr ""
#: fileread.cc:420 #: fileread.cc:422
#, c-format #, c-format
msgid "%s: cannot find -l%s\n" msgid "%s: cannot find -l%s\n"
msgstr "" msgstr ""
#: fileread.cc:444 #: fileread.cc:449
#, c-format #, c-format
msgid "%s: cannot find %s\n" msgid "%s: cannot find %s\n"
msgstr "" msgstr ""
#: fileread.cc:454 #: fileread.cc:460
#, c-format #, c-format
msgid "%s: cannot open %s: %s\n" msgid "%s: cannot open %s: %s\n"
msgstr "" msgstr ""
@ -317,13 +317,13 @@ msgstr ""
msgid "%s: %s: both SUN and GNU model TLS relocations\n" msgid "%s: %s: both SUN and GNU model TLS relocations\n"
msgstr "" msgstr ""
#: merge.cc:247 #: merge.cc:255
#, c-format #, c-format
msgid "" msgid ""
"%s: %s: mergeable string section length not multiple of character size\n" "%s: %s: mergeable string section length not multiple of character size\n"
msgstr "" msgstr ""
#: merge.cc:264 #: merge.cc:272
#, c-format #, c-format
msgid "%s: %s: entry in mergeable string section not null terminated\n" msgid "%s: %s: entry in mergeable string section not null terminated\n"
msgstr "" msgstr ""
@ -338,107 +338,107 @@ msgstr ""
msgid "%s: %s: section name section has wrong type: %u\n" msgid "%s: %s: section name section has wrong type: %u\n"
msgstr "" msgstr ""
#: object.cc:248 #: object.cc:249
#, c-format #, c-format
msgid "%s: %s: invalid symbol table name index: %u\n" msgid "%s: %s: invalid symbol table name index: %u\n"
msgstr "" msgstr ""
#: object.cc:256 #: object.cc:257
#, c-format #, c-format
msgid "%s: %s: symbol table name section has wrong type: %u\n" msgid "%s: %s: symbol table name section has wrong type: %u\n"
msgstr "" msgstr ""
#: object.cc:312 #: object.cc:313
#, c-format #, c-format
msgid "%s: %s: section group %u info %u out of range\n" msgid "%s: %s: section group %u info %u out of range\n"
msgstr "" msgstr ""
#: object.cc:330 #: object.cc:331
#, c-format #, c-format
msgid "%s: %s: symbol %u name offset %u out of range\n" msgid "%s: %s: symbol %u name offset %u out of range\n"
msgstr "" msgstr ""
#: object.cc:364 #: object.cc:365
#, c-format #, c-format
msgid "%s: %s: section %u in section group %u out of range" msgid "%s: %s: section %u in section group %u out of range"
msgstr "" msgstr ""
#: object.cc:508 #: object.cc:509
#, c-format #, c-format
msgid "%s: %s: size of symbols is not multiple of symbol size\n" msgid "%s: %s: size of symbols is not multiple of symbol size\n"
msgstr "" msgstr ""
#: object.cc:600 #: object.cc:601
#, c-format #, c-format
msgid "%s: %s: unknown section index %u for local symbol %u\n" msgid "%s: %s: unknown section index %u for local symbol %u\n"
msgstr "" msgstr ""
#: object.cc:611 #: object.cc:612
#, c-format #, c-format
msgid "%s: %s: local symbol %u section index %u out of range\n" msgid "%s: %s: local symbol %u section index %u out of range\n"
msgstr "" msgstr ""
#: object.cc:645 #: object.cc:646
#, c-format #, c-format
msgid "%s: %s: local symbol %u section name out of range: %u >= %u\n" msgid "%s: %s: local symbol %u section name out of range: %u >= %u\n"
msgstr "" msgstr ""
#: object.cc:880 #: object.cc:895
#, c-format #, c-format
msgid "%s: %s: unsupported ELF file type %d\n" msgid "%s: %s: unsupported ELF file type %d\n"
msgstr "" msgstr ""
#: object.cc:899 object.cc:952 object.cc:987 #: object.cc:914 object.cc:967 object.cc:1002
#, c-format #, c-format
msgid "%s: %s: ELF file too short\n" msgid "%s: %s: ELF file too short\n"
msgstr "" msgstr ""
#: object.cc:908 #: object.cc:923
#, c-format #, c-format
msgid "%s: %s: invalid ELF version 0\n" msgid "%s: %s: invalid ELF version 0\n"
msgstr "" msgstr ""
#: object.cc:911 #: object.cc:926
#, c-format #, c-format
msgid "%s: %s: unsupported ELF version %d\n" msgid "%s: %s: unsupported ELF version %d\n"
msgstr "" msgstr ""
#: object.cc:919 #: object.cc:934
#, c-format #, c-format
msgid "%s: %s: invalid ELF class 0\n" msgid "%s: %s: invalid ELF class 0\n"
msgstr "" msgstr ""
#: object.cc:926 #: object.cc:941
#, c-format #, c-format
msgid "%s: %s: unsupported ELF class %d\n" msgid "%s: %s: unsupported ELF class %d\n"
msgstr "" msgstr ""
#: object.cc:934 #: object.cc:949
#, c-format #, c-format
msgid "%s: %s: invalid ELF data encoding\n" msgid "%s: %s: invalid ELF data encoding\n"
msgstr "" msgstr ""
#: object.cc:941 #: object.cc:956
#, c-format #, c-format
msgid "%s: %s: unsupported ELF data encoding %d\n" msgid "%s: %s: unsupported ELF data encoding %d\n"
msgstr "" msgstr ""
#: object.cc:964 #: object.cc:979
#, c-format #, c-format
msgid "%s: %s: not configured to support 32-bit big-endian object\n" msgid "%s: %s: not configured to support 32-bit big-endian object\n"
msgstr "" msgstr ""
#: object.cc:977 #: object.cc:992
#, c-format #, c-format
msgid "%s: %s: not configured to support 32-bit little-endian object\n" msgid "%s: %s: not configured to support 32-bit little-endian object\n"
msgstr "" msgstr ""
#: object.cc:999 #: object.cc:1014
#, c-format #, c-format
msgid "%s: %s: not configured to support 64-bit big-endian object\n" msgid "%s: %s: not configured to support 64-bit big-endian object\n"
msgstr "" msgstr ""
#: object.cc:1012 #: object.cc:1027
#, c-format #, c-format
msgid "%s: %s: not configured to support 64-bit little-endian object\n" msgid "%s: %s: not configured to support 64-bit little-endian object\n"
msgstr "" msgstr ""
@ -519,128 +519,136 @@ msgid "-R DIR, -rpath DIR"
msgstr "" msgstr ""
#: options.cc:337 #: options.cc:337
msgid "Create exception frame header" msgid "Strip all symbols"
msgstr "" msgstr ""
#: options.cc:340 #: options.cc:339
msgid "Add DIR to link time shared library search path" msgid "Strip debugging information"
msgstr "" msgstr ""
#: options.cc:341 #: options.cc:341
msgid "--rpath-link DIR" msgid "Create exception frame header"
msgstr "" msgstr ""
#: options.cc:343 #: options.cc:344
msgid "Generate shared library" msgid "Add DIR to link time shared library search path"
msgstr "" msgstr ""
#: options.cc:345 #: options.cc:345
msgid "Do not link against shared libraries" msgid "--rpath-link DIR"
msgstr "" msgstr ""
#: options.cc:347 #: options.cc:347
msgid "Generate shared library"
msgstr ""
#: options.cc:349
msgid "Do not link against shared libraries"
msgstr ""
#: options.cc:351
msgid "Set target system root directory" msgid "Set target system root directory"
msgstr "" msgstr ""
#: options.cc:348 #: options.cc:352
msgid "--sysroot DIR" msgid "--sysroot DIR"
msgstr "" msgstr ""
#: options.cc:350 #: options.cc:354
msgid "Only set DT_NEEDED for dynamic libs if used" msgid "Only set DT_NEEDED for dynamic libs if used"
msgstr "" msgstr ""
#: options.cc:353 #: options.cc:357
msgid "Always DT_NEEDED for dynamic libs (default)" msgid "Always DT_NEEDED for dynamic libs (default)"
msgstr "" msgstr ""
#: options.cc:356 #: options.cc:360
msgid "Include all archive contents" msgid "Include all archive contents"
msgstr "" msgstr ""
#: options.cc:360 #: options.cc:364
msgid "Include only needed archive contents" msgid "Include only needed archive contents"
msgstr "" msgstr ""
#: options.cc:363 #: options.cc:367
msgid "Report usage information" msgid "Report usage information"
msgstr "" msgstr ""
#: options.cc:365 #: options.cc:369
msgid "Report version information" msgid "Report version information"
msgstr "" msgstr ""
#: options.cc:568 #: options.cc:573
msgid "unexpected argument" msgid "unexpected argument"
msgstr "" msgstr ""
#: options.cc:575 options.cc:626 options.cc:707 #: options.cc:580 options.cc:631 options.cc:732
msgid "missing argument" msgid "missing argument"
msgstr "" msgstr ""
#: options.cc:588 options.cc:635 #: options.cc:593 options.cc:640
msgid "unknown option" msgid "unknown option"
msgstr "" msgstr ""
#: options.cc:643 #: options.cc:648
#, c-format #, c-format
msgid "%s: missing group end" msgid "%s: missing group end"
msgstr "" msgstr ""
#: options.cc:720 #: options.cc:745
msgid "may not nest groups" msgid "may not nest groups"
msgstr "" msgstr ""
#: options.cc:730 #: options.cc:755
msgid "group end without group start" msgid "group end without group start"
msgstr "" msgstr ""
#: options.cc:740 #: options.cc:765
#, c-format #, c-format
msgid "%s: use the --help option for usage information\n" msgid "%s: use the --help option for usage information\n"
msgstr "" msgstr ""
#: options.cc:749 script.cc:1169 #: options.cc:774 script.cc:1169
#, c-format #, c-format
msgid "%s: %s: %s\n" msgid "%s: %s: %s\n"
msgstr "" msgstr ""
#: options.cc:758 #: options.cc:783
#, c-format #, c-format
msgid "%s: -%c: %s\n" msgid "%s: -%c: %s\n"
msgstr "" msgstr ""
#: output.cc:1011 #: output.cc:1031
#, c-format #, c-format
msgid "%s: %s: invalid alignment %lu for section \"%s\"\n" msgid "%s: %s: invalid alignment %lu for section \"%s\"\n"
msgstr "" msgstr ""
#: output.cc:1660 #: output.cc:1699
#, c-format #, c-format
msgid "%s: %s: open: %s\n" msgid "%s: %s: open: %s\n"
msgstr "" msgstr ""
#: output.cc:1669 #: output.cc:1708
#, c-format #, c-format
msgid "%s: %s: lseek: %s\n" msgid "%s: %s: lseek: %s\n"
msgstr "" msgstr ""
#: output.cc:1676 #: output.cc:1715
#, c-format #, c-format
msgid "%s: %s: write: %s\n" msgid "%s: %s: write: %s\n"
msgstr "" msgstr ""
#: output.cc:1686 #: output.cc:1725
#, c-format #, c-format
msgid "%s: %s: mmap: %s\n" msgid "%s: %s: mmap: %s\n"
msgstr "" msgstr ""
#: output.cc:1700 #: output.cc:1739
#, c-format #, c-format
msgid "%s: %s: munmap: %s\n" msgid "%s: %s: munmap: %s\n"
msgstr "" msgstr ""
#: output.cc:1708 #: output.cc:1747
#, c-format #, c-format
msgid "%s: %s: close: %s\n" msgid "%s: %s: close: %s\n"
msgstr "" msgstr ""
@ -716,12 +724,12 @@ msgstr ""
msgid "%s: %s: versym for symbol %zu has no name: %u\n" msgid "%s: %s: versym for symbol %zu has no name: %u\n"
msgstr "" msgstr ""
#: symtab.cc:1248 symtab.cc:1445 #: symtab.cc:1248 symtab.cc:1451
#, c-format #, c-format
msgid "%s: %s: unsupported symbol section 0x%x\n" msgid "%s: %s: unsupported symbol section 0x%x\n"
msgstr "" msgstr ""
#: symtab.cc:1665 #: symtab.cc:1671
#, c-format #, c-format
msgid "%s: %s: warning: %s\n" msgid "%s: %s: warning: %s\n"
msgstr "" msgstr ""