This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to allow ELF backends to add their own command line switches


Hi Guys,

  I would like to submit the following patch for approval.  It adds
  code to the default ELF linker script (ld/emultempl/elf.sc) so that
  individual ELF targets can have their own command line switches,
  without being forced to create (and maintain) their own linker
  scripts.

  I wanted this feature for the mcore-elf port, where I want to add an
  mcore specific linker switch.

  Any comments ?

Cheers
	Nick


1999-08-20  Nick Clifton  <nickc@cygnus.com>

	* emultempl/elf32.em: Add ability for individual targets to have
	their own command line switches by defining PARSE_AND_LIST_ARGS.

Index: elf32.em
===================================================================
RCS file: /cvs/cvsfiles/devo/ld/emultempl/elf32.em,v
retrieving revision 1.60
diff -p -r1.60 elf32.em
*** elf32.em	1999/07/23 22:13:02	1.60
--- elf32.em	1999/08/20 13:13:40
*************** EOF
*** 1144,1151 ****
--- 1144,1167 ----
  
  fi
  
+ if test -n "$PARSE_AND_LIST_ARGS" ; then
  cat >>e${EMULATION_NAME}.c <<EOF
+ static int  gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
+ static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE * file));
  
+  $PARSE_AND_LIST_ARGS
+ EOF
+ else
+ 
+ cat >>e${EMULATION_NAME}.c <<EOF
+ #define gld_${EMULATION_NAME}_parse_args   NULL
+ #define gld_${EMULATION_NAME}_list_options NULL
+ EOF
+ 
+ fi
+ 
+ cat >>e${EMULATION_NAME}.c <<EOF
+ 
  struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = 
  {
    gld${EMULATION_NAME}_before_parse,
*************** struct ld_emulation_xfer_struct ld_${EMU
*** 1160,1173 ****
    gld${EMULATION_NAME}_get_script,
    "${EMULATION_NAME}",
    "${OUTPUT_FORMAT}",
!   NULL,
!   NULL,
    gld${EMULATION_NAME}_open_dynamic_archive,
    gld${EMULATION_NAME}_place_orphan,
!   NULL,		/* set_symbols */
!   NULL,		/* parse_args */
!   NULL,		/* unrecognized_file */
!   NULL,		/* list_options */
!   NULL		/* recognized_file */
  };
  EOF
--- 1176,1189 ----
    gld${EMULATION_NAME}_get_script,
    "${EMULATION_NAME}",
    "${OUTPUT_FORMAT}",
!   NULL, /* finish */
!   NULL, /* create output section statements */
    gld${EMULATION_NAME}_open_dynamic_archive,
    gld${EMULATION_NAME}_place_orphan,
!   NULL, /* set symbols */
!   gld_${EMULATION_NAME}_parse_args,
!   NULL, /* unrecognized file */
!   gld_${EMULATION_NAME}_list_options,
!   NULL  /* recognized file */
  };
  EOF

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]