public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* -X for ar and nm.
@ 2000-07-26 16:34 Geoff Keating
  0 siblings, 0 replies; 4+ messages in thread
From: Geoff Keating @ 2000-07-26 16:34 UTC (permalink / raw)
  To: binutils

The GCC build process on AIX passes -X32_64 to ar and nm, because for
the native tools this is necessary to make stuff work.  The
functionality this turns on is the default for GNU ar and nm, and it's
convenient to have GNU ar and GNU nm take these flags so you don't
have to worry about which one you're using.

Thus this patch.  Tested on powerpc-linux.

OK to commit?

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/rs6000-binu-X-2.patch==============
2000-07-26  Geoff Keating  <geoffk@cygnus.com>

	* nm.c (main): Ignore '-X32_64' as an option.
	* ar.c (main): Likewise.

Index: ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.16
diff -p -u -u -p -r1.16 ar.c
--- ar.c	2000/06/26 23:15:58	1.16
+++ ar.c	2000/07/26 23:29:54
@@ -431,6 +431,17 @@ main (argc, argv)
 
   xatexit (remove_output);
 
+  /* Ignored for (partial) AIX compatibility.  On AIX,
+     the -X option can be used to ignore certain kinds
+     of object files in the archive (the 64-bit objects
+     or the 32-bit objects).  GNU ar always looks at all
+     kinds of objects in an archive.  */
+  while (strcmp (argv[1], "-X32_64") == 0)
+    {
+      argv++;
+      argc--;
+    }
+
   if (is_ranlib)
     {
       boolean touch = false;
Index: nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.9
diff -p -u -u -p -r1.9 nm.c
--- nm.c	2000/07/20 18:02:55	1.9
+++ nm.c	2000/07/26 23:29:54
@@ -409,7 +409,7 @@ main (argc, argv)
   bfd_init ();
   set_default_bfd_target ();
 
-  while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvV",
+  while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvVX:",
 			   long_options, (int *) 0)) != EOF)
     {
       switch (c)
@@ -479,6 +479,17 @@ main (argc, argv)
 	  break;
 	case 'V':
 	  show_version = 1;
+	  break;
+	case 'X':
+	  /* Ignored for (partial) AIX compatibility.  On AIX, the
+	     argument has values 32, 64, or 32_64, and specfies that
+	     only 32-bit, only 64-bit, or both kinds of objects should
+	     be examined.  The default is 32.  So plain AIX nm on a
+	     library archive with both kinds of objects will ignore
+	     the 64-bit ones.  For GNU nm, the default is and always
+	     has been -X 32_64, and other options are not supported.  */
+	  if (strcmp (optarg, "32_64") != 0)
+	    fatal (_("Only -X 32_64 is supported"));
 	  break;
 
 	case OPTION_TARGET:	/* --target */
============================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -X for ar and nm.
@ 2000-07-26 17:58 Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2000-07-26 17:58 UTC (permalink / raw)
  To: geoffk; +Cc: binutils

Hi Geoff,

: 2000-07-26  Geoff Keating  <geoffk@cygnus.com>
: 
: 	* nm.c (main): Ignore '-X32_64' as an option.
: 	* ar.c (main): Likewise.
: 	* binutils.texi (nm): Document new option.
: 	(ar): Likewise.

Approved.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -X for ar and nm.
  2000-07-26 16:54 Nick Clifton
@ 2000-07-26 17:44 ` Geoff Keating
  0 siblings, 0 replies; 4+ messages in thread
From: Geoff Keating @ 2000-07-26 17:44 UTC (permalink / raw)
  To: nickc; +Cc: binutils

> Date: Wed, 26 Jul 2000 16:54:52 -0700
> From: Nick Clifton <nickc@cygnus.com>

...
> Well... If you are going to add a new command line option, even if
> only to silently ignore it, then you ought to add it to the
> binutils.texi document and the usage() functions.

Done.  I wasn't sure if silently ignored options should be documented.

> Also, if the target is AIX, wouldn't it be useful to generate a
> warning message if a -X option is given which does not match the
> default behavior of the tool concerned ?  Just so that users don't
> get confused when they use the switch, but it does not work and there
> is no message explaining why.

It gives an error, on all platforms.  This is probably what you want,
particularly in ar, because continuing could trash your archive.

Here's the revised patch.  I've tested it and checked that the info
doc still builds.

OK to commit?

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/rs6000-binu-X-3.patch==============
2000-07-26  Geoff Keating  <geoffk@cygnus.com>

	* nm.c (main): Ignore '-X32_64' as an option.
	* ar.c (main): Likewise.
	* binutils.texi (nm): Document new option.
	(ar): Likewise.

Index: ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.16
diff -p -u -u -p -r1.16 ar.c
--- ar.c	2000/06/26 23:15:58	1.16
+++ ar.c	2000/07/27 00:42:30
@@ -250,7 +250,7 @@ usage (help)
   if (! is_ranlib)
     {
       /* xgettext:c-format */
-      fprintf (s, _("Usage: %s [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"),
+      fprintf (s, _("Usage: %s [-X32_64] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"),
 	       program_name);
       /* xgettext:c-format */
       fprintf (s, _("       %s -M [<mri-script]\n"), program_name);
@@ -276,6 +276,7 @@ usage (help)
       fprintf (s, _("  [S]          - do not build a symbol table\n"));
       fprintf (s, _("  [v]          - be verbose\n"));
       fprintf (s, _("  [V]          - display the version number\n"));
+      fprintf (s, _("  [-X32_64]    - (ignored)\n"));
     }
   else
     /* xgettext:c-format */
@@ -430,6 +431,17 @@ main (argc, argv)
   show_version = 0;
 
   xatexit (remove_output);
+
+  /* Ignored for (partial) AIX compatibility.  On AIX,
+     the -X option can be used to ignore certain kinds
+     of object files in the archive (the 64-bit objects
+     or the 32-bit objects).  GNU ar always looks at all
+     kinds of objects in an archive.  */
+  while (strcmp (argv[1], "-X32_64") == 0)
+    {
+      argv++;
+      argc--;
+    }
 
   if (is_ranlib)
     {
Index: binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/binutils.texi,v
retrieving revision 1.25
diff -p -u -u -p -r1.25 binutils.texi
--- binutils.texi	2000/07/21 00:09:48	1.25
+++ binutils.texi	2000/07/27 00:42:32
@@ -234,7 +234,7 @@ program.
 @section Controlling @code{ar} on the command line
 
 @smallexample
-ar [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}]
+ar [-X32_64] [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}]
 @end smallexample
 
 @cindex Unix compatibility, @code{ar}
@@ -451,6 +451,12 @@ when the modifier @samp{v} is appended.
 This modifier shows the version number of @code{ar}.
 @end table
 
+@code{ar} ignores an initial option spelt @code{-X32_64}, for
+compatibility with AIX.  The behaviour produced by this option is the
+default for GNU @code{ar}.  @code{ar} does not support any of the other
+@code{-X} options; in particular, it does not support @code{-X32}
+which is the default for AIX @code{ar}.
+
 @node ar scripts
 @section Controlling @code{ar} with a script
 
@@ -636,8 +642,8 @@ nm [ -a | --debug-syms ]  [ -g | --exter
    [ -r | --reverse-sort ]  [ --size-sort ] [ -u | --undefined-only ]
    [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
    [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
-   [ --defined-only ] [-l | --line-numbers ]
-   [ --no-demangle ] [ -V | --version ]  [ --help ]  [ @var{objfile}@dots{} ]
+   [ --defined-only ] [-l | --line-numbers ]  [ --no-demangle ]
+   [ -V | --version ]  [ -X 32_64 ]  [ --help ]  [ @var{objfile}@dots{} ]
 @end smallexample
 
 @sc{gnu} @code{nm} lists the symbols from object files @var{objfile}@dots{}.
@@ -854,6 +860,12 @@ Display only defined symbols for each ob
 @item -V
 @itemx --version
 Show the version number of @code{nm} and exit.
+
+@item -X
+This option is ignored for compatibility with the AIX version of
+@code{nm}.  It takes one parameter which must be the string
+@code{32_64}.  The default mode of AIX @code{nm} corresponds
+to @code{-X 32}, which is not supported by @sc{gnu} @code{nm}.
 
 @item --help
 Show a summary of the options to @code{nm} and exit.
Index: nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.9
diff -p -u -u -p -r1.9 nm.c
--- nm.c	2000/07/20 18:02:55	1.9
+++ nm.c	2000/07/27 00:42:33
@@ -321,6 +321,7 @@ usage (stream, status)
       --target=BFDNAME   Specify the target object format as BFDNAME\n\
   -u, --undefined-only   Display only undefined symbols\n\
   -V, --version          Display this program's version number\n\
+  -X 32_64               (ignored)\n\
 \n"));
   list_supported_targets (program_name, stream);
   if (status == 0)
@@ -409,7 +410,7 @@ main (argc, argv)
   bfd_init ();
   set_default_bfd_target ();
 
-  while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvV",
+  while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvVX:",
 			   long_options, (int *) 0)) != EOF)
     {
       switch (c)
@@ -479,6 +480,17 @@ main (argc, argv)
 	  break;
 	case 'V':
 	  show_version = 1;
+	  break;
+	case 'X':
+	  /* Ignored for (partial) AIX compatibility.  On AIX, the
+	     argument has values 32, 64, or 32_64, and specfies that
+	     only 32-bit, only 64-bit, or both kinds of objects should
+	     be examined.  The default is 32.  So plain AIX nm on a
+	     library archive with both kinds of objects will ignore
+	     the 64-bit ones.  For GNU nm, the default is and always
+	     has been -X 32_64, and other options are not supported.  */
+	  if (strcmp (optarg, "32_64") != 0)
+	    fatal (_("Only -X 32_64 is supported"));
 	  break;
 
 	case OPTION_TARGET:	/* --target */
============================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -X for ar and nm.
@ 2000-07-26 16:54 Nick Clifton
  2000-07-26 17:44 ` Geoff Keating
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2000-07-26 16:54 UTC (permalink / raw)
  To: geoffk; +Cc: binutils

Hi Geoff,

: The GCC build process on AIX passes -X32_64 to ar and nm, because for
: the native tools this is necessary to make stuff work.  The
: functionality this turns on is the default for GNU ar and nm, and it's
: convenient to have GNU ar and GNU nm take these flags so you don't
: have to worry about which one you're using.
: 
: Thus this patch.  Tested on powerpc-linux.
: 
: OK to commit?

Well... If you are going to add a new command line option, even if
only to silently ignore it, then you ought to add it to the
binutils.texi document and the usage() functions.

Also, if the target is AIX, wouldn't it be useful to generate a
warning message if a -X option is given which does not match the
default behavior of the tool concerned ?  Just so that users don't
get confused when they use the switch, but it does not work and there
is no message explaining why.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-07-26 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-26 16:34 -X for ar and nm Geoff Keating
2000-07-26 16:54 Nick Clifton
2000-07-26 17:44 ` Geoff Keating
2000-07-26 17:58 Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).