From 22d3533cae93cfc6fe9ad74d8b04a7735a4fd3cb Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 3 Jul 1995 18:40:26 +0000 Subject: [PATCH] * lexsup.c (parse_args): Let -G either set the small data size or be equivalent to --shared, depending on the next argument. Accept and ignore -z for Solaris compatibility. PR 7118. --- ld/ChangeLog | 6 ++++++ ld/lexsup.c | 26 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 9d95aa1e91d..4d0f2aa55d1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +Mon Jul 3 14:39:22 1995 Ian Lance Taylor + + * lexsup.c (parse_args): Let -G either set the small data size or + be equivalent to --shared, depending on the next argument. Accept + and ignore -z for Solaris compatibility. + Sun Jul 2 17:52:34 1995 Ian Lance Taylor * lexsup.c (parse_args): Cast fopen result to PTR before storing diff --git a/ld/lexsup.c b/ld/lexsup.c index 9fb28cea537..f361eae87ad 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -21,6 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "sysdep.h" #include #include +#include #include "getopt.h" #include "bfdlink.h" #include "config.h" @@ -55,6 +56,7 @@ parse_args (argc, argv) int argc; char **argv; { + int i; int ingroup = 0; /* Starting the short option string with '-' is for programs that @@ -63,7 +65,7 @@ parse_args (argc, argv) as if it were the argument of an option with character code 1. */ const char *shortopts = - "-a:A:B::b:c:de:F::G:giL:l:Mm:NnO:o:R:rSsT:tu:VvXxY:y:()"; + "-a:A:B::b:c:de:F::G:giL:l:Mm:NnO:o:R:rSsT:tu:VvXxY:y:z:()"; /* 150 isn't special; it's just an arbitrary non-ASCII char value. */ @@ -159,6 +161,23 @@ parse_args (argc, argv) {NULL, no_argument, NULL, 0} }; + /* The -G option is ambiguous on different platforms. Sometimes it + specifies the largest data size to put into the small data + section. Sometimes it is equivalent to --shared. Unfortunately, + the first form takes an argument, while the second does not. + + We need to permit the --shared form because on some platforms, + such as Solaris, gcc -shared will pass -G to the linker. + + To permit either usage, we look through the argument list. If we + find -G not followed by a number, we change it into --shared. + This will work for most normal cases. */ + for (i = 1; i < argc; i++) + if (strcmp (argv[i], "-G") == 0 + && (i + 1 >= argc + || ! isdigit (argv[i + 1][0]))) + argv[i] = (char *) "--shared"; + while (1) { /* getopt_long_only is like getopt_long, but '-' as well as '--' can @@ -452,6 +471,11 @@ parse_args (argc, argv) case 'y': add_ysym (optarg); break; + case 'z': + /* We accept and ignore this option for Solaris + compatibility. Actually, on Solaris, optarg is not + ignored. Someday we should handle it correctly. FIXME. */ + break; case OPTION_SPLIT_BY_RELOC: config.split_by_reloc = atoi (optarg); break; -- 2.30.2