From 7b40f2b16942598c1041724395e4dd20a7b5ec14 Mon Sep 17 00:00:00 2001 From: David MacKenzie Date: Thu, 27 Jan 1994 20:49:21 +0000 Subject: [PATCH] * ldmain.c ldmain.h ldgram.y: If -v -V or --version was given, exit successfully instead of complaining if no input files are given. --- ld/ChangeLog | 6 ++++++ ld/ldgram.y | 20 ++++++++++++++++---- ld/ldmain.c | 8 +++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 57791fd..f51ca01 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +Thu Jan 27 12:35:01 1994 David J. Mackenzie (djm@thepub.cygnus.com) + + * ldmain.c ldmain.h ldgram.y: If -v -V or --version was given, + exit successfully instead of complaining if no input files are + given. + Tue Jan 25 13:19:41 1994 Stan Shebs (shebs@andros.cygnus.com) * Makefile.in: Format variable definitions consistently. diff --git a/ld/ldgram.y b/ld/ldgram.y index b66a099..dc196aec 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -118,14 +118,14 @@ static int error_index; %token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY %token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S OPTION_sort_common OPTION_warn_common %token OPTION_EB OPTION_EL OPTION_G OPTION_Gval OPTION_help -%token OPTION_format OPTION_oformat OPTION_F OPTION_u OPTION_Bstatic OPTION_N +%token OPTION_format OPTION_oformat OPTION_F OPTION_u OPTION_y OPTION_Bstatic OPTION_N %token SIZEOF NEXT ADDR %token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym %token OPTION_v OPTION_V OPTION_m OPTION_memul OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT %token OPTION_L OPTION_Map %token OPTION_n OPTION_r OPTION_o OPTION_b OPTION_R OPTION_relax OPTION_version %token OPTION_l OPTION_Lfile OPTION_T OPTION_Aarch OPTION_Tfile -%token OPTION_Texp OPTION_y +%token OPTION_Texp OPTION_esymbol OPTION_usymbol OPTION_ysymbol %token OPTION_Ur %token ORIGIN FILL OPTION_g %token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS @@ -165,16 +165,18 @@ command_line_option: | OPTION_v { ldversion(0); + version_printed = true; } | OPTION_V { ldversion(1); + version_printed = true; trace_file_tries = true; } | OPTION_version { ldversion(0); - exit(0); + version_printed = true; } | OPTION_t { trace_files = true; @@ -218,6 +220,9 @@ command_line_option: | OPTION_u NAME { ldlang_add_undef($2); } + | OPTION_usymbol { + ldlang_add_undef($1); + } | OPTION_r { link_info.relocateable = true; config.build_constructors = false; @@ -237,6 +242,9 @@ command_line_option: | OPTION_e NAME { lang_add_entry($2); } + | OPTION_esymbol + { lang_add_entry($1); + } | OPTION_X { link_info.discard = discard_l; } @@ -292,7 +300,11 @@ command_line_option: lang_section_start($1,exp_intop($3)); hex_mode = 0; } - | OPTION_y + | OPTION_y NAME + { + add_ysym($2); + } + | OPTION_ysymbol { add_ysym($1); } diff --git a/ld/ldmain.c b/ld/ldmain.c index 4eb5fce..403d028 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -67,6 +67,10 @@ boolean trace_files; /* Nonzero means same, but note open failures, too. */ boolean trace_file_tries; +/* Nonzero means version number was printed, so exit successfully + instead of complaining if no input files are given. */ +boolean version_printed; + /* 1 => write load map. */ boolean write_map; @@ -143,7 +147,7 @@ main (argc, argv) bfd_init (); /* Initialize the data about options. */ - trace_files = trace_file_tries = false; + trace_files = trace_file_tries = version_printed = false; write_map = false; config.build_constructors = true; command_line.force_common_definition = false; @@ -208,6 +212,8 @@ main (argc, argv) if (lang_has_input_file == false) { + if (version_printed) + exit (0); einfo ("%P%F: no input files\n"); } -- 2.7.4