public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch]: ld: ignore --identification for ld/alpha-vms
@ 2011-05-04  7:31 Tristan Gingold
  2011-05-04  7:45 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2011-05-04  7:31 UTC (permalink / raw)
  To: binutils Development

Hi,

this is an alpha-vms specific patch that slightly modifies emultempl/generic.em by allowing to
define two emulation fields (looks like that now all emulation fields can be defined in generic.em).

This patch simply ignore the --identification switch for compatibility with the vms linker.

Ok for trunk ?

Tristan.

ld/
2011-05-04  Tristan Gingold  <gingold@adacore.com>

	* emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Add
	LDEMUL_ADD_OPTIONS and LDEMUL_HANDLE_OPTION.
	* emultempl/vms.em (OPTION_IDENTIFICATION): New macro.
	(gld${EMULATION_NAME}_add_options): New function.
	(gld${EMULATION_NAME}_list_options): Ditto.
	(gld${EMULATION_NAME}_handle_option): Ditto.
	(LDEMUL_ADD_OPTIONS, LDEMUL_HANDLE_OPTION)
	(LDEMUL_LIST_OPTIONS): Define.


diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index 4a84680..20ec356 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -138,8 +138,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
   ${LDEMUL_PLACE_ORPHAN-NULL},
   ${LDEMUL_SET_SYMBOLS-NULL},
   ${LDEMUL_PARSE_ARGS-NULL},
-  NULL,	/* add_options */
-  NULL,	/* handle_option */
+  ${LDEMUL_ADD_OPTIONS-NULL},
+  ${LDEMUL_HANDLE_OPTION-NULL},
   ${LDEMUL_UNRECOGNIZED_FILE-NULL},
   ${LDEMUL_LIST_OPTIONS-NULL},
   ${LDEMUL_RECOGNIZED_FILE-NULL},
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index fb8fd53..6107c56 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -23,6 +23,8 @@
 # This file is sourced from generic.em.
 
 fragment <<EOF
+#include "getopt.h"
+
 static void
 gld${EMULATION_NAME}_before_parse (void)
 {
@@ -117,6 +119,51 @@ vms_place_orphan (asection *s,
   else
     return NULL;
 }
+
+/* VMS specific options.  */
+#define OPTION_IDENTIFICATION		(300  + 1)
+
+static void
+gld${EMULATION_NAME}_add_options
+  (int ns ATTRIBUTE_UNUSED,
+   char **shortopts ATTRIBUTE_UNUSED,
+   int nl,
+   struct option **longopts,
+   int nrl ATTRIBUTE_UNUSED,
+   struct option **really_longopts ATTRIBUTE_UNUSED)
+{
+  static const struct option xtra_long[] = {
+    {"identification", required_argument, NULL, OPTION_IDENTIFICATION},
+    {NULL, no_argument, NULL, 0}
+  };
+
+  *longopts
+    = xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
+  memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
+}
+
+static void
+gld${EMULATION_NAME}_list_options (FILE *file)
+{
+  fprintf (file, _("  --identification <string>          Set the identification of the output\n"));
+}
+
+static bfd_boolean
+gld${EMULATION_NAME}_handle_option (int optc)
+{
+  switch (optc)
+    {
+    default:
+      return FALSE;
+
+    case OPTION_IDENTIFICATION:
+      /* Currently ignored.  */
+      break;
+    }
+
+  return TRUE;
+}
+
 EOF
 
 LDEMUL_PLACE_ORPHAN=vms_place_orphan
@@ -124,3 +171,6 @@ LDEMUL_BEFORE_PARSE=gld"$EMULATION_NAME"_before_parse
 LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=gld"$EMULATION_NAME"_create_output_section_statements
 LDEMUL_FIND_POTENTIAL_LIBRARIES=gld"$EMULATION_NAME"_find_potential_libraries
 LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld"$EMULATION_NAME"_open_dynamic_archive
+LDEMUL_ADD_OPTIONS=gld"$EMULATION_NAME"_add_options
+LDEMUL_HANDLE_OPTION=gld"$EMULATION_NAME"_handle_option
+LDEMUL_LIST_OPTIONS=gld"$EMULATION_NAME"_list_options

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

* Re: [Patch]: ld: ignore --identification for ld/alpha-vms
  2011-05-04  7:31 [Patch]: ld: ignore --identification for ld/alpha-vms Tristan Gingold
@ 2011-05-04  7:45 ` Alan Modra
  2011-05-04  8:32   ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2011-05-04  7:45 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils Development

On Wed, May 04, 2011 at 09:31:32AM +0200, Tristan Gingold wrote:
> 	* emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Add
> 	LDEMUL_ADD_OPTIONS and LDEMUL_HANDLE_OPTION.
> 	* emultempl/vms.em (OPTION_IDENTIFICATION): New macro.
> 	(gld${EMULATION_NAME}_add_options): New function.
> 	(gld${EMULATION_NAME}_list_options): Ditto.
> 	(gld${EMULATION_NAME}_handle_option): Ditto.
> 	(LDEMUL_ADD_OPTIONS, LDEMUL_HANDLE_OPTION)
> 	(LDEMUL_LIST_OPTIONS): Define.

Looks OK.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [Patch]: ld: ignore --identification for ld/alpha-vms
  2011-05-04  7:45 ` Alan Modra
@ 2011-05-04  8:32   ` Tristan Gingold
  0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2011-05-04  8:32 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils Development


On May 4, 2011, at 9:44 AM, Alan Modra wrote:

> On Wed, May 04, 2011 at 09:31:32AM +0200, Tristan Gingold wrote:
>> 	* emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Add
>> 	LDEMUL_ADD_OPTIONS and LDEMUL_HANDLE_OPTION.
>> 	* emultempl/vms.em (OPTION_IDENTIFICATION): New macro.
>> 	(gld${EMULATION_NAME}_add_options): New function.
>> 	(gld${EMULATION_NAME}_list_options): Ditto.
>> 	(gld${EMULATION_NAME}_handle_option): Ditto.
>> 	(LDEMUL_ADD_OPTIONS, LDEMUL_HANDLE_OPTION)
>> 	(LDEMUL_LIST_OPTIONS): Define.
> 
> Looks OK.

I consider this as an approval.  Committed on trunk.
Thank you for your super fast answer.

Tristan.

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

end of thread, other threads:[~2011-05-04  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04  7:31 [Patch]: ld: ignore --identification for ld/alpha-vms Tristan Gingold
2011-05-04  7:45 ` Alan Modra
2011-05-04  8:32   ` Tristan Gingold

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).