scoreelf.em 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # This shell script emits a C file. -*- C -*-
  2. # Copyright (C) 2006-2015 Free Software Foundation, Inc.
  3. # Contributed by:
  4. # Brain.lin (brain.lin@sunplusct.com)
  5. # Mei Ligang (ligang@sunnorth.com.cn)
  6. # Pei-Lin Tsai (pltsai@sunplus.com)
  7. # This file is part of the GNU Binutils.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 3 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  22. # MA 02110-1301, USA.
  23. #
  24. # This file is sourced from elf32.em, and defines extra score-elf
  25. # specific routines.
  26. #
  27. fragment <<EOF
  28. #include "elf32-score.h"
  29. static void
  30. gld${EMULATION_NAME}_before_parse ()
  31. {
  32. #ifndef TARGET_ /* I.e., if not generic. */
  33. ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
  34. #endif /* not TARGET_ */
  35. input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
  36. config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
  37. config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
  38. }
  39. static void
  40. score_elf_after_open (void)
  41. {
  42. if (strstr (bfd_get_target (link_info.output_bfd), "score") == NULL)
  43. {
  44. /* The score backend needs special fields in the output hash structure.
  45. These will only be created if the output format is an score format,
  46. hence we do not support linking and changing output formats at the
  47. same time. Use a link followed by objcopy to change output formats. */
  48. einfo ("%F%X%P: error: cannot change output format whilst linking S+core binaries\n");
  49. return;
  50. }
  51. /* Call the standard elf routine. */
  52. gld${EMULATION_NAME}_after_open ();
  53. }
  54. EOF
  55. # Define some shell vars to insert bits of code into the standard elf
  56. # parse_args and list_options functions.
  57. #
  58. PARSE_AND_LIST_PROLOGUE=''
  59. PARSE_AND_LIST_SHORTOPTS=
  60. PARSE_AND_LIST_LONGOPTS=''
  61. PARSE_AND_LIST_OPTIONS=''
  62. PARSE_AND_LIST_ARGS_CASES=''
  63. # We have our own after_open and before_allocation functions, but they call
  64. # the standard routines, so give them a different name.
  65. LDEMUL_AFTER_OPEN=score_elf_after_open
  66. # Replace the elf before_parse function with our own.
  67. LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse