This is the mail archive of the binutils@sources.redhat.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]

[RFA:] Make ld/emultempl/generic.em a little bit more generic


When linking to MMO (Knuth's educational object format used with
mmix-knuth-mmixware) I need to set the ld_emulation_xfer_struct
after_allocation field to a non-default function, but I don't
want to build an *.em from scratch.  It occurred to me that I
should be able to use generic.em.  It should be what its name
implies; it could be at least as generic as elf32.em from which
this patch borrows.  Tested by building and checking cris-aout
and looking at the generic.em-derived ecrisaout.c.

Ok to commit?

	* emultempl/generic.em: Support EXTRA_EM_FILE.
	(ld_${EMULATION_NAME}_emulation): Support emulation parameters
	LDEMUL_BEFORE_PARSE, LDEMUL_SYSLIB, LDEMUL_HLL,
	LDEMUL_AFTER_PARSE, LDEMUL_AFTER_OPEN, LDEMUL_AFTER_ALLOCATION,
	LDEMUL_SET_OUTPUT_ARCH, LDEMUL_CHOOSE_TARGET,
	LDEMUL_BEFORE_ALLOCATION, LDEMUL_GET_SCRIPT, LDEMUL_FINISH,
	LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS,
	LDEMUL_OPEN_DYNAMIC_ARCHIVE, LDEMUL_PLACE_ORPHAN,
	LDEMUL_SET_SYMBOLS, LDEMUL_PARSE_ARGS, LDEMUL_UNRECOGNIZED_FILE,
	LDEMUL_LIST_OPTIONS, LDEMUL_RECOGNIZED_FILE,
	LDEMUL_FIND_POTENTIAL_LIBRARIES.

Index: generic.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/generic.em,v
retrieving revision 1.6
diff -p -c -r1.6 generic.em
*** generic.em	2001/03/13 06:14:27	1.6
--- generic.em	2001/08/12 14:50:35
*************** Foundation, Inc., 59 Temple Place - Suit
*** 42,47 ****
--- 42,58 ----
  static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
  static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));

+ EOF
+
+ # Import any needed special functions and/or overrides.
+ #
+ if test -n "$EXTRA_EM_FILE" ; then
+ . ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
+ fi
+
+ if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
+ cat >>e${EMULATION_NAME}.c <<EOF
+
  static void
  gld${EMULATION_NAME}_before_parse()
  {
*************** gld${EMULATION_NAME}_before_parse()
*** 50,55 ****
--- 61,72 ----
  #endif /* not TARGET_ */
  }

+ EOF
+ fi
+
+ if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
+ cat >>e${EMULATION_NAME}.c <<EOF
+
  static char *
  gld${EMULATION_NAME}_get_script(isfile)
       int *isfile;
*************** cat >>e${EMULATION_NAME}.c <<EOF
*** 99,132 ****
      return "ldscripts/${EMULATION_NAME}.x";
  }
  EOF
!
  fi

  cat >>e${EMULATION_NAME}.c <<EOF

  struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
  {
!   gld${EMULATION_NAME}_before_parse,
!   syslib_default,
!   hll_default,
!   after_parse_default,
!   after_open_default,
!   after_allocation_default,
!   set_output_arch_default,
!   ldemul_default_target,
!   before_allocation_default,
!   gld${EMULATION_NAME}_get_script,
    "${EMULATION_NAME}",
    "${OUTPUT_FORMAT}",
!   NULL,	/* finish */
!   NULL,	/* create output section statements */
!   NULL,	/* open dynamic archive */
!   NULL,	/* place orphan */
!   NULL,	/* set symbols */
!   NULL,	/* parse args */
!   NULL,	/* unrecognized file */
!   NULL,	/* list options */
!   NULL,	/* recognized file */
!   NULL 	/* find_potential_libraries */
  };
  EOF
--- 116,149 ----
      return "ldscripts/${EMULATION_NAME}.x";
  }
  EOF
! fi
  fi

  cat >>e${EMULATION_NAME}.c <<EOF

  struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
  {
!   ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
!   ${LDEMUL_SYSLIB-syslib_default},
!   ${LDEMUL_HLL-hll_default},
!   ${LDEMUL_AFTER_PARSE-after_parse_default},
!   ${LDEMUL_AFTER_OPEN-after_open_default},
!   ${LDEMUL_AFTER_ALLOCATION-after_allocation_default},
!   ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
!   ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
!   ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
!   ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
    "${EMULATION_NAME}",
    "${OUTPUT_FORMAT}",
!   ${LDEMUL_FINISH-NULL},
!   ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
!   ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
!   ${LDEMUL_PLACE_ORPHAN-NULL},
!   ${LDEMUL_SET_SYMBOLS-NULL},
!   ${LDEMUL_PARSE_ARGS-NULL},
!   ${LDEMUL_UNRECOGNIZED_FILE-NULL},
!   ${LDEMUL_LIST_OPTIONS-NULL},
!   ${LDEMUL_RECOGNIZED_FILE-NULL},
!   ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL}
  };
  EOF

brgds, H-P


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