From 333f1559085b033818c59a4b1585d592b721b41c Mon Sep 17 00:00:00 2001 From: iant Date: Sun, 7 Oct 2007 18:06:27 +0000 Subject: [PATCH] Add --version option. --- gold/Makefile.am | 1 + gold/Makefile.in | 4 +- gold/configure | 50 ++++++++------ gold/configure.ac | 7 +- gold/gold.h | 4 ++ gold/options.cc | 14 +++- gold/po/POTFILES.in | 1 + gold/po/gold.pot | 191 +++++++++++++++++++++++++++++++--------------------- gold/version.cc | 58 ++++++++++++++++ 9 files changed, 230 insertions(+), 100 deletions(-) create mode 100644 gold/version.cc diff --git a/gold/Makefile.am b/gold/Makefile.am index f61dac3d45..87bde55423 100644 --- a/gold/Makefile.am +++ b/gold/Makefile.am @@ -46,6 +46,7 @@ CCFILES = \ symtab.cc \ stringpool.cc \ target-select.cc \ + version.cc \ workqueue.cc HFILES = \ diff --git a/gold/Makefile.in b/gold/Makefile.in index b687104297..13a3536063 100644 --- a/gold/Makefile.in +++ b/gold/Makefile.in @@ -77,7 +77,7 @@ am__objects_1 = archive.$(OBJEXT) common.$(OBJEXT) defstd.$(OBJEXT) \ options.$(OBJEXT) output.$(OBJEXT) parameters.$(OBJEXT) \ readsyms.$(OBJEXT) reloc.$(OBJEXT) resolve.$(OBJEXT) \ script.$(OBJEXT) symtab.$(OBJEXT) stringpool.$(OBJEXT) \ - target-select.$(OBJEXT) workqueue.$(OBJEXT) + target-select.$(OBJEXT) version.$(OBJEXT) workqueue.$(OBJEXT) am__objects_2 = am__objects_3 = yyscript.$(OBJEXT) am_libgold_a_OBJECTS = $(am__objects_1) $(am__objects_2) \ @@ -297,6 +297,7 @@ CCFILES = \ symtab.cc \ stringpool.cc \ target-select.cc \ + version.cc \ workqueue.cc HFILES = \ @@ -471,6 +472,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringpool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/target-select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/workqueue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x86_64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yyscript.Po@am__quote@ diff --git a/gold/configure b/gold/configure index adfd485b56..305fe72e69 100755 --- a/gold/configure +++ b/gold/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. +# Generated by GNU Autoconf 2.59 for gold 0.1. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -265,11 +265,11 @@ SHELL=${CONFIG_SHELL-/bin/sh} : ${ac_max_here_lines=38} # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= +PACKAGE_NAME='gold' +PACKAGE_TARNAME='gold' +PACKAGE_VERSION='0.1' +PACKAGE_STRING='gold 0.1' +PACKAGE_BUGREPORT='' ac_unique_file="gold.cc" # Factoring default headers for most tests. @@ -786,7 +786,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. +\`configure' configures gold 0.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -852,7 +852,9 @@ _ACEOF fi if test -n "$ac_init_help"; then - + case $ac_init_help in + short | recursive ) echo "Configuration of gold 0.1:";; + esac cat <<\_ACEOF Optional Features: @@ -981,6 +983,8 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF +gold configure 0.1 +generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -993,7 +997,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by $as_me, which was +It was created by gold $as_me 0.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1323,6 +1327,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -1712,8 +1724,8 @@ fi # Define the identity of the package. - PACKAGE=gold - VERSION=0.1 + PACKAGE='gold' + VERSION='0.1' cat >>confdefs.h <<_ACEOF @@ -5251,9 +5263,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >& echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ------------------------------- ## +## Report this to the gold lists. ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -5402,9 +5414,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >& echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ------------------------------- ## +## Report this to the gold lists. ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -5922,7 +5934,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by $as_me, which was +This file was extended by gold $as_me 0.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5985,7 +5997,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -config.status +gold config.status 0.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/gold/configure.ac b/gold/configure.ac index af62d4a69b..0e0bc7ef0d 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -1,12 +1,13 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT -AC_CONFIG_SRCDIR([gold.cc]) + +AC_INIT(gold, 0.1) +AC_CONFIG_SRCDIR(gold.cc) AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE(gold, 0.1) +AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h:config.in) diff --git a/gold/gold.h b/gold/gold.h index 14d4aeec98..91669ee10d 100644 --- a/gold/gold.h +++ b/gold/gold.h @@ -207,6 +207,10 @@ extern void do_gold_unreachable(const char*, int, const char*) #define gold_assert(expr) ((void)(!(expr) ? gold_unreachable(), 0 : 0)) +// Print version information. +extern void +print_version(bool print_short); + // Queue up the first set of tasks. extern void queue_initial_tasks(const General_options&, diff --git a/gold/options.cc b/gold/options.cc index f49b9f57f1..4ddb1acdbb 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -220,6 +220,16 @@ help(int, char**, char*, gold::Command_line*) return 0; } +// Report version information. + +int +version(int, char**, char* opt, gold::Command_line*) +{ + gold::print_version(opt[0] == 'v' && opt[1] == '\0'); + gold::gold_exit(true); + return 0; +} + // If the default sysroot is relocatable, try relocating it based on // the prefix FROM. @@ -351,7 +361,9 @@ options::Command_line_options::options[] = NULL, TWO_DASHES, &Position_dependent_options::clear_whole_archive), SPECIAL('\0', "help", N_("Report usage information"), NULL, - TWO_DASHES, &help) + TWO_DASHES, &help), + SPECIAL('v', "version", N_("Report version information"), NULL, + TWO_DASHES, &version) }; const int options::Command_line_options::options_size = diff --git a/gold/po/POTFILES.in b/gold/po/POTFILES.in index 8c529d570f..9628afac0c 100644 --- a/gold/po/POTFILES.in +++ b/gold/po/POTFILES.in @@ -46,6 +46,7 @@ target.h target-reloc.h target-select.cc target-select.h +version.cc workqueue.cc workqueue.h x86_64.cc diff --git a/gold/po/gold.pot b/gold/po/gold.pot index ca36b5cdce..cf5aea9e65 100644 --- a/gold/po/gold.pot +++ b/gold/po/gold.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-01 16:41-0700\n" +"POT-Creation-Date: 2007-10-07 11:04-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -176,42 +176,47 @@ msgstr "" msgid "%s: symbol %s has undefined version %s\n" msgstr "" -#: fileread.cc:48 +#: fileread.cc:49 #, c-format msgid "%s: munmap failed: %s\n" msgstr "" -#: fileread.cc:83 +#: fileread.cc:84 #, c-format msgid "%s: warning: close(%s) failed: %s" msgstr "" -#: fileread.cc:108 +#: fileread.cc:109 #, c-format msgid "%s: %s: fstat failed: %s" msgstr "" -#: fileread.cc:198 +#: fileread.cc:199 #, c-format msgid "%s: %s: pread failed: %s\n" msgstr "" -#: fileread.cc:205 +#: fileread.cc:206 #, c-format msgid "%s: %s: file too short: read only %lld of %lld bytes at %lld\n" msgstr "" -#: fileread.cc:283 +#: fileread.cc:284 #, c-format msgid "%s: %s: mmap offset %lld size %lld failed: %s\n" msgstr "" -#: fileread.cc:402 +#: fileread.cc:420 +#, c-format +msgid "%s: cannot find -l%s\n" +msgstr "" + +#: fileread.cc:444 #, c-format msgid "%s: cannot find %s\n" msgstr "" -#: fileread.cc:410 +#: fileread.cc:454 #, c-format msgid "%s: cannot open %s: %s\n" msgstr "" @@ -265,61 +270,64 @@ msgid "pthread_cond_signal failed" msgstr "" #. FIXME: This needs to specify the location somehow. -#: i386.cc:130 x86_64.cc:137 +#: i386.cc:131 x86_64.cc:146 #, c-format msgid "%s: missing expected TLS relocation\n" msgstr "" -#. TODO(csilvers): correct? -#. TODO(csilvers): correct? -#: i386.cc:749 i386.cc:910 i386.cc:1172 x86_64.cc:744 x86_64.cc:911 -#: x86_64.cc:1247 +#: i386.cc:775 i386.cc:942 i386.cc:1210 x86_64.cc:737 x86_64.cc:898 +#: x86_64.cc:1215 #, c-format msgid "%s: %s: unexpected reloc %u in object file\n" msgstr "" -#: i386.cc:786 i386.cc:806 x86_64.cc:781 x86_64.cc:804 +#: i386.cc:816 i386.cc:836 x86_64.cc:766 x86_64.cc:782 #, c-format msgid "%s: %s: unsupported reloc %u against local symbol\n" msgstr "" -#: i386.cc:946 i386.cc:967 x86_64.cc:947 x86_64.cc:971 +#: i386.cc:982 i386.cc:1003 x86_64.cc:927 x86_64.cc:940 #, c-format msgid "%s: %s: unsupported reloc %u against global symbol %s\n" msgstr "" -#: i386.cc:990 +#: i386.cc:1026 #, c-format msgid "%s: %s: unsupported RELA reloc section\n" msgstr "" -#: i386.cc:1080 x86_64.cc:1084 +#: i386.cc:1116 x86_64.cc:1053 #, c-format msgid "%s: %s: missing expected TLS relocation\n" msgstr "" -#: i386.cc:1204 i386.cc:1281 i386.cc:1292 x86_64.cc:1287 x86_64.cc:1365 -#: x86_64.cc:1374 +#: i386.cc:1244 i386.cc:1321 i386.cc:1344 i386.cc:1367 x86_64.cc:1237 +#: x86_64.cc:1307 x86_64.cc:1315 #, c-format msgid "%s: %s: unsupported reloc %u\n" msgstr "" -#: i386.cc:1231 x86_64.cc:1315 +#: i386.cc:1271 x86_64.cc:1264 #, c-format msgid "%s: %s: TLS reloc but no TLS segment\n" msgstr "" -#: i386.cc:1266 x86_64.cc:1350 +#: i386.cc:1306 x86_64.cc:1292 #, c-format msgid "%s: %s: unsupported reloc type %u\n" msgstr "" -#: i386.cc:1475 x86_64.cc:1562 +#: i386.cc:1332 +#, c-format +msgid "%s: %s: both SUN and GNU model TLS relocations\n" +msgstr "" + +#: i386.cc:1584 x86_64.cc:1463 #, c-format msgid "%s: %s: TLS relocation out of range\n" msgstr "" -#: i386.cc:1493 x86_64.cc:1580 +#: i386.cc:1602 x86_64.cc:1481 #, c-format msgid "%s: %s: TLS relocation against invalid instruction\n" msgstr "" @@ -375,228 +383,244 @@ msgstr "" msgid "%s: %s: size of symbols is not multiple of symbol size\n" msgstr "" -#: object.cc:597 +#: object.cc:600 #, c-format msgid "%s: %s: unknown section index %u for local symbol %u\n" msgstr "" -#: object.cc:608 +#: object.cc:611 #, c-format msgid "%s: %s: local symbol %u section index %u out of range\n" msgstr "" -#: object.cc:642 +#: object.cc:645 #, c-format msgid "%s: %s: local symbol %u section name out of range: %u >= %u\n" msgstr "" -#: object.cc:860 +#: object.cc:880 #, c-format msgid "%s: %s: unsupported ELF file type %d\n" msgstr "" -#: object.cc:879 object.cc:932 object.cc:967 +#: object.cc:899 object.cc:952 object.cc:987 #, c-format msgid "%s: %s: ELF file too short\n" msgstr "" -#: object.cc:888 +#: object.cc:908 #, c-format msgid "%s: %s: invalid ELF version 0\n" msgstr "" -#: object.cc:891 +#: object.cc:911 #, c-format msgid "%s: %s: unsupported ELF version %d\n" msgstr "" -#: object.cc:899 +#: object.cc:919 #, c-format msgid "%s: %s: invalid ELF class 0\n" msgstr "" -#: object.cc:906 +#: object.cc:926 #, c-format msgid "%s: %s: unsupported ELF class %d\n" msgstr "" -#: object.cc:914 +#: object.cc:934 #, c-format msgid "%s: %s: invalid ELF data encoding\n" msgstr "" -#: object.cc:921 +#: object.cc:941 #, c-format msgid "%s: %s: unsupported ELF data encoding %d\n" msgstr "" -#: object.cc:944 +#: object.cc:964 #, c-format msgid "%s: %s: not configured to support 32-bit big-endian object\n" msgstr "" -#: object.cc:957 +#: object.cc:977 #, c-format msgid "%s: %s: not configured to support 32-bit little-endian object\n" msgstr "" -#: object.cc:979 +#: object.cc:999 #, c-format msgid "%s: %s: not configured to support 64-bit big-endian object\n" msgstr "" -#: object.cc:992 +#: object.cc:1012 #, c-format msgid "%s: %s: not configured to support 64-bit little-endian object\n" msgstr "" -#: options.cc:135 +#: options.cc:139 #, c-format msgid "" "Usage: %s [options] file...\n" "Options:\n" msgstr "" -#: options.cc:250 +#: options.cc:309 msgid "Search for library LIBNAME" msgstr "" -#: options.cc:251 +#: options.cc:310 msgid "-lLIBNAME, --library LIBNAME" msgstr "" -#: options.cc:253 +#: options.cc:312 msgid "Start a library search group" msgstr "" -#: options.cc:255 +#: options.cc:314 msgid "End a library search group" msgstr "" -#: options.cc:257 +#: options.cc:316 msgid "Export all dynamic symbols" msgstr "" -#: options.cc:259 +#: options.cc:318 msgid "Set dynamic linker path" msgstr "" -#: options.cc:260 +#: options.cc:319 msgid "-I PROGRAM, --dynamic-linker PROGRAM" msgstr "" -#: options.cc:262 +#: options.cc:321 msgid "Add directory to search path" msgstr "" -#: options.cc:263 +#: options.cc:322 msgid "-L DIR, --library-path DIR" msgstr "" -#: options.cc:265 +#: options.cc:324 msgid "Ignored for compatibility" msgstr "" -#: options.cc:267 +#: options.cc:326 msgid "Optimize output file size" msgstr "" -#: options.cc:268 +#: options.cc:327 msgid "-O level" msgstr "" -#: options.cc:270 +#: options.cc:329 msgid "Set output file name" msgstr "" -#: options.cc:271 +#: options.cc:330 msgid "-o FILE, --output FILE" msgstr "" -#: options.cc:273 +#: options.cc:332 msgid "Generate relocatable output" msgstr "" -#: options.cc:275 +#: options.cc:334 msgid "Add DIR to runtime search path" msgstr "" -#: options.cc:276 +#: options.cc:335 msgid "-R DIR, -rpath DIR" msgstr "" -#: options.cc:278 +#: options.cc:337 msgid "Create exception frame header" msgstr "" -#: options.cc:281 +#: options.cc:340 msgid "Add DIR to link time shared library search path" msgstr "" -#: options.cc:282 +#: options.cc:341 msgid "--rpath-link DIR" msgstr "" -#: options.cc:284 +#: options.cc:343 msgid "Generate shared library" msgstr "" -#: options.cc:286 +#: options.cc:345 msgid "Do not link against shared libraries" msgstr "" -#: options.cc:289 +#: options.cc:347 +msgid "Set target system root directory" +msgstr "" + +#: options.cc:348 +msgid "--sysroot DIR" +msgstr "" + +#: options.cc:350 msgid "Only set DT_NEEDED for dynamic libs if used" msgstr "" -#: options.cc:292 +#: options.cc:353 msgid "Always DT_NEEDED for dynamic libs (default)" msgstr "" -#: options.cc:295 +#: options.cc:356 msgid "Include all archive contents" msgstr "" -#: options.cc:299 +#: options.cc:360 msgid "Include only needed archive contents" msgstr "" -#: options.cc:302 +#: options.cc:363 msgid "Report usage information" msgstr "" -#: options.cc:445 options.cc:496 options.cc:575 +#: options.cc:365 +msgid "Report version information" +msgstr "" + +#: options.cc:568 +msgid "unexpected argument" +msgstr "" + +#: options.cc:575 options.cc:626 options.cc:707 msgid "missing argument" msgstr "" -#: options.cc:458 options.cc:505 +#: options.cc:588 options.cc:635 msgid "unknown option" msgstr "" -#: options.cc:513 +#: options.cc:643 #, c-format msgid "%s: missing group end" msgstr "" -#: options.cc:588 +#: options.cc:720 msgid "may not nest groups" msgstr "" -#: options.cc:598 +#: options.cc:730 msgid "group end without group start" msgstr "" -#: options.cc:608 +#: options.cc:740 #, c-format msgid "%s: use the --help option for usage information\n" msgstr "" -#: options.cc:617 script.cc:1158 +#: options.cc:749 script.cc:1169 #, c-format msgid "%s: %s: %s\n" msgstr "" -#: options.cc:626 +#: options.cc:758 #, c-format msgid "%s: -%c: %s\n" msgstr "" @@ -727,7 +751,22 @@ msgstr "" msgid "%s: %s: undefined reference to '%s'\n" msgstr "" -#: x86_64.cc:994 +#. This output is intended to follow the GNU standards. +#: version.cc:50 +#, c-format +msgid "Copyright 2007 Free Software Foundation, Inc.\n" +msgstr "" + +#: version.cc:51 +#, c-format +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License version 3 or (at your option) a later " +"version.\n" +"This program has absolutely no warranty.\n" +msgstr "" + +#: x86_64.cc:963 #, c-format msgid "%s: %s: unsupported REL reloc section\n" msgstr "" diff --git a/gold/version.cc b/gold/version.cc new file mode 100644 index 0000000000..d7ad19cc59 --- /dev/null +++ b/gold/version.cc @@ -0,0 +1,58 @@ +// version.c -- print gold version information + +// Copyright 2006, 2007 Free Software Foundation, Inc. +// Written by Ian Lance Taylor . + +// This file is part of gold. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +// MA 02110-1301, USA. + +#include "gold.h" + +#include "../bfd/bfdver.h" + +namespace gold +{ + +// The version of gold. + +// FIXME: This should eventually be PACKAGE_VERSION, and get the +// version number from configure.ac. But it's easier to just change +// this file for now. + +static const char* version_string = "0.1"; + +// Report version information. + +void +print_version(bool print_short) +{ + /* xgettext:c-format */ + printf("GNU gold (GNU binutils %s) version %s\n", + BFD_VERSION_STRING, version_string); + + if (!print_short) + { + // This output is intended to follow the GNU standards. + printf (_("Copyright 2007 Free Software Foundation, Inc.\n")); + printf (_("\ +This program is free software; you may redistribute it under the terms of\n\ +the GNU General Public License version 3 or (at your option) a later version.\n\ +This program has absolutely no warranty.\n")); + } +} + +} // End namespace gold. -- 2.11.0