diff options
-rw-r--r-- | ld/ChangeLog.mpw | 15 | ||||
-rw-r--r-- | ld/mpw-config.in | 42 | ||||
-rw-r--r-- | ld/mpw-em.c | 283 | ||||
-rw-r--r-- | ld/mpw-emipsidt.c | 431 | ||||
-rw-r--r-- | ld/mpw-make.in | 151 |
5 files changed, 565 insertions, 357 deletions
diff --git a/ld/ChangeLog.mpw b/ld/ChangeLog.mpw index cc5538b..f422678 100644 --- a/ld/ChangeLog.mpw +++ b/ld/ChangeLog.mpw @@ -1,3 +1,18 @@ +Fri Mar 17 15:42:33 1995 Stan Shebs <shebs@andros.cygnus.com> + + * mpw-config.in (i386-unknown-aout): Change to i386-unknown-go32. + (i386-unknown-coff): Remove. + (sh-hitachi-hms): New target. + (emulation_ofiles): Set correctly for each target. + (version, TDEFINES): Add to makefile fragment. + * mpw-make.in (BISON): Use byacc instead of bison. + (em_*.c): Replace with e*.c everywhere. + (ldgram.h): Separate action from ldgram.c generation. + (LD_PROG): Depend on Version.r. + (Version.r): generate from version info. + * mpw-em.c: Remove. + * mpw-emipsidt.c: New file, modified for MPW from emipsidt.c. + Wed Dec 14 13:29:52 1994 Stan Shebs <shebs@andros.cygnus.com> * mpw-config.in (m68k-apple-macos, ppc-apple-macos, diff --git a/ld/mpw-config.in b/ld/mpw-config.in index 44e3411..928e903 100644 --- a/ld/mpw-config.in +++ b/ld/mpw-config.in @@ -2,26 +2,38 @@ If "{target_canonical}" =~ /m68k-apple-macos/ Set emulname m68kcoff + forward-include "{srcdir}"mpw-em68kcoff.c em68kcoff.c + Set emulation_ofiles "{o}"em68kcoff.c.o Else If "{target_canonical}" =~ /ppc-apple-macos/ - Set emulname ppcelf -Else If "{target_canonical}" =~ /i386-unknown-aout/ - Set emulname i386aout -Else If "{target_canonical}" =~ /i386-unknown-coff/ - Set emulname i386coff + Set emulname xcoff + forward-include "{srcdir}"mpw-excoff.c excoff.c + Set emulation_ofiles "{o}"excoff.c.o +Else If "{target_canonical}" =~ /i386-unknown-go32/ + Set emulname i386go32 + forward-include "{srcdir}"mpw-ei386go32.c ei386go32.c + Set emulation_ofiles "{o}"ei386go32.c.o Else If "{target_canonical}" =~ /mips-idt-ecoff/ Set emulname mipsidt - forward-include "{srcdir}"mpw-em.c em_mipsidt.c + forward-include "{srcdir}"mpw-emipsidt.c emipsidt.c + Set emulation_ofiles "{o}"emipsidt.c.o +Else If "{target_canonical}" =~ /sh-hitachi-hms/ + Set emulname sh + forward-include "{srcdir}"mpw-esh.c esh.c + Set emulation_ofiles "{o}"esh.c.o End If -Echo '/* This file is automatically generated. DO NOT EDIT! */' >ldemul-tmp.h -Echo "extern ld_emulation_xfer_type ld_{emulname}_emulation;" >>ldemul-tmp.h -Echo '#define EMULATION_LIST \' >>ldemul-tmp.h -Echo " &ld_{emulname}_emulation, \" >>ldemul-tmp.h -Echo ' 0' >>ldemul-tmp.h -MoveIfChange ldemul-tmp.h ldemul-list.h +Echo '/* This file is automatically generated. DO NOT EDIT! */' > "{o}"ldemul-tmp.h +Echo "extern ld_emulation_xfer_type ld_{emulname}_emulation;" >> "{o}"ldemul-tmp.h +Echo '#define EMULATION_LIST \' >> "{o}"ldemul-tmp.h +Echo " &ld_{emulname}_emulation, \" >> "{o}"ldemul-tmp.h +Echo ' 0' >> "{o}"ldemul-tmp.h +MoveIfChange "{o}"ldemul-tmp.h "{o}"ldemul-list.h -Echo '# From mpw-config.in' > "{o}"mk.tmp +Echo '# From mpw-config.in' > "{o}"mk.tmp -Echo "EMUL = " {emulname} >> "{o}"mk.tmp +Echo "EMUL = " {emulname} >> "{o}"mk.tmp +Echo "EMULATION_OFILES = " {emulation_ofiles} >> "{o}"mk.tmp +Echo 'version = ' `Search 'ld version ' {srcdir}ldver.c | sed -e 's/.*ld version \([^ ]*\).*/\1/'` >> "{o}"mk.tmp +Echo "TDEFINES = " >> "{o}"mk.tmp -Echo '# End from mpw-config.in' >> "{o}"mk.tmp +Echo '# End from mpw-config.in' >> "{o}"mk.tmp diff --git a/ld/mpw-em.c b/ld/mpw-em.c deleted file mode 100644 index 665dfac..0000000 --- a/ld/mpw-em.c +++ /dev/null @@ -1,283 +0,0 @@ -/* This file is is generated by a shell script. DO NOT EDIT! */ - -/* emulate the original gld for the given mipsidt - Copyright (C) 1991, 1993 Free Software Foundation, Inc. - Written by Steve Chamberlain steve@cygnus.com - -This file is part of GLD, the Gnu Linker. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define TARGET_IS_mipsidt - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" - -#include "ld.h" -#include "config.h" -#include "ldmain.h" -#include "ldemul.h" -#include "ldfile.h" -#include "ldmisc.h" - -static void gldmipsidt_before_parse PARAMS ((void)); -static char *gldmipsidt_get_script PARAMS ((int *isfile)); - -static void -gldmipsidt_before_parse() -{ -#ifndef TARGET_ /* I.e., if not generic. */ - ldfile_output_architecture = bfd_arch_mips; -#endif /* not TARGET_ */ -} - -static char * -gldmipsidt_get_script(isfile) - int *isfile; -{ - *isfile = 0; - - if (link_info.relocateable == true && config.build_constructors == true) - return "OUTPUT_FORMAT(\"ecoff-bigmips\")\n\ -ENTRY(start)\n\ -SECTIONS\n\ -{\n\ - .text : {\n\ - ;\n\ - *(.init)\n\ - ;\n\ - *(.text)\n\ - *(.fini)\n\ - ;\n\ - ;\n\ - }\n\ - .rdata : {\n\ - *(.rdata)\n\ - }\n\ - .data : {\n\ - *(.data)\n\ - CONSTRUCTORS\n\ - }\n\ - .lit8 : {\n\ - *(.lit8)\n\ - }\n\ - .lit4 : {\n\ - *(.lit4)\n\ - }\n\ - .sdata : {\n\ - *(.sdata)\n\ - }\n\ - .sbss : {\n\ - *(.sbss)\n\ - *(.scommon)\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(COMMON)\n\ - }\n\ -}\n\n"; - else if (link_info.relocateable == true) - return "OUTPUT_FORMAT(\"ecoff-bigmips\")\n\ -ENTRY(start)\n\ -SECTIONS\n\ -{\n\ - .text : {\n\ - ;\n\ - *(.init)\n\ - ;\n\ - *(.text)\n\ - *(.fini)\n\ - ;\n\ - ;\n\ - }\n\ - .rdata : {\n\ - *(.rdata)\n\ - }\n\ - .data : {\n\ - *(.data)\n\ - }\n\ - .lit8 : {\n\ - *(.lit8)\n\ - }\n\ - .lit4 : {\n\ - *(.lit4)\n\ - }\n\ - .sdata : {\n\ - *(.sdata)\n\ - }\n\ - .sbss : {\n\ - *(.sbss)\n\ - *(.scommon)\n\ - }\n\ - .bss : {\n\ - *(.bss)\n\ - *(COMMON)\n\ - }\n\ -}\n\n"; - else if (!config.text_read_only) - return "OUTPUT_FORMAT(\"ecoff-bigmips\")\n\ -ENTRY(start)\n\ -SECTIONS\n\ -{\n\ - .text 0xa0012000 : {\n\ - _ftext = . ;\n\ - *(.init)\n\ - eprol = .;\n\ - *(.text)\n\ - *(.fini)\n\ - etext = .;\n\ - _etext = .;\n\ - }\n\ - .rdata . : {\n\ - *(.rdata)\n\ - }\n\ - _fdata = .;\n\ - .data . : {\n\ - *(.data)\n\ - CONSTRUCTORS\n\ - }\n\ - _gp = . + 0x8000;\n\ - .lit8 . : {\n\ - *(.lit8)\n\ - }\n\ - .lit4 . : {\n\ - *(.lit4)\n\ - }\n\ - .sdata . : {\n\ - *(.sdata)\n\ - }\n\ - edata = .;\n\ - _edata = .;\n\ - _fbss = .;\n\ - .sbss . : {\n\ - *(.sbss)\n\ - *(.scommon)\n\ - }\n\ - .bss . : {\n\ - *(.bss)\n\ - *(COMMON)\n\ - }\n\ - end = .;\n\ - _end = .;\n\ -}\n\n"; - else if (!config.magic_demand_paged) - return "OUTPUT_FORMAT(\"ecoff-bigmips\")\n\ -ENTRY(start)\n\ -SECTIONS\n\ -{\n\ - .text 0xa0012000 : {\n\ - _ftext = . ;\n\ - *(.init)\n\ - eprol = .;\n\ - *(.text)\n\ - *(.fini)\n\ - etext = .;\n\ - _etext = .;\n\ - }\n\ - .rdata . : {\n\ - *(.rdata)\n\ - }\n\ - _fdata = .;\n\ - .data . : {\n\ - *(.data)\n\ - CONSTRUCTORS\n\ - }\n\ - _gp = . + 0x8000;\n\ - .lit8 . : {\n\ - *(.lit8)\n\ - }\n\ - .lit4 . : {\n\ - *(.lit4)\n\ - }\n\ - .sdata . : {\n\ - *(.sdata)\n\ - }\n\ - edata = .;\n\ - _edata = .;\n\ - _fbss = .;\n\ - .sbss . : {\n\ - *(.sbss)\n\ - *(.scommon)\n\ - }\n\ - .bss . : {\n\ - *(.bss)\n\ - *(COMMON)\n\ - }\n\ - end = .;\n\ - _end = .;\n\ -}\n\n"; - else - return "OUTPUT_FORMAT(\"ecoff-bigmips\")\n\ -ENTRY(start)\n\ -SECTIONS\n\ -{\n\ - .text 0xa0012000 : {\n\ - _ftext = . ;\n\ - *(.init)\n\ - eprol = .;\n\ - *(.text)\n\ - *(.fini)\n\ - etext = .;\n\ - _etext = .;\n\ - }\n\ - .rdata . : {\n\ - *(.rdata)\n\ - }\n\ - _fdata = .;\n\ - .data . : {\n\ - *(.data)\n\ - CONSTRUCTORS\n\ - }\n\ - _gp = . + 0x8000;\n\ - .lit8 . : {\n\ - *(.lit8)\n\ - }\n\ - .lit4 . : {\n\ - *(.lit4)\n\ - }\n\ - .sdata . : {\n\ - *(.sdata)\n\ - }\n\ - edata = .;\n\ - _edata = .;\n\ - _fbss = .;\n\ - .sbss . : {\n\ - *(.sbss)\n\ - *(.scommon)\n\ - }\n\ - .bss . : {\n\ - *(.bss)\n\ - *(COMMON)\n\ - }\n\ - end = .;\n\ - _end = .;\n\ -}\n\n"; -} - -struct ld_emulation_xfer_struct ld_mipsidt_emulation = -{ - gldmipsidt_before_parse, - syslib_default, - hll_default, - after_parse_default, - after_allocation_default, - set_output_arch_default, - ldemul_default_target, - before_allocation_default, - gldmipsidt_get_script, - "mipsidt", - "ecoff-bigmips" -}; diff --git a/ld/mpw-emipsidt.c b/ld/mpw-emipsidt.c new file mode 100644 index 0000000..2a791bf --- /dev/null +++ b/ld/mpw-emipsidt.c @@ -0,0 +1,431 @@ +/* This file is is generated by a shell script. DO NOT EDIT! */ + +/* Handle embedded relocs for MIPS. + Copyright 1994 Free Software Foundation, Inc. + Written by Ian Lance Taylor <ian@cygnus.com> based on generic.em. + +This file is part of GLD, the Gnu Linker. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#define TARGET_IS_mipsidt + +#include "libiberty.h" +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" + +#include "ld.h" +#include "config.h" +#include "ldmain.h" +#include "ldemul.h" +#include "ldfile.h" +#include "ldmisc.h" + +static void gldmipsidt_before_parse PARAMS ((void)); +static void gldmipsidt_after_open PARAMS ((void)); +static void check_sections PARAMS ((bfd *, asection *, PTR)); +static void gldmipsidt_after_allocation PARAMS ((void)); +static char *gldmipsidt_get_script PARAMS ((int *isfile)); + +static void +gldmipsidt_before_parse() +{ +#ifndef TARGET_ /* I.e., if not generic. */ + ldfile_output_architecture = bfd_arch_mips; +#endif /* not TARGET_ */ +} + +/* This function is run after all the input files have been opened. + We create a .rel.sdata section for each input file with a non zero + .sdata section. The BFD backend will fill in these sections with + magic numbers which can be used to relocate the data section at run + time. This will only do the right thing if all the input files + have been compiled using -membedded-pic. */ + +static void +gldmipsidt_after_open () +{ + bfd *abfd; + + if (! command_line.embedded_relocs + || link_info.relocateable) + return; + + for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next) + { + asection *datasec; + + datasec = bfd_get_section_by_name (abfd, ".sdata"); + + /* Note that we assume that the reloc_count field has already + been set up. We could call bfd_get_reloc_upper_bound, but + that returns the size of a memory buffer rather than a reloc + count. We do not want to call bfd_canonicalize_reloc, + because although it would always work it would force us to + read in the relocs into BFD canonical form, which would waste + a significant amount of time and memory. */ + if (datasec != NULL && datasec->reloc_count > 0) + { + asection *relsec; + + relsec = bfd_make_section (abfd, ".rel.sdata"); + if (relsec == NULL + || ! bfd_set_section_flags (abfd, relsec, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY)) + || ! bfd_set_section_alignment (abfd, relsec, 2) + || ! bfd_set_section_size (abfd, relsec, + datasec->reloc_count * 4)) + einfo ("%F%B: can not create .rel.sdata section: %E"); + } + + /* Double check that all other data sections are empty, as is + required for embedded PIC code. */ + bfd_map_over_sections (abfd, check_sections, (PTR) datasec); + } +} + +/* Check that of the data sections, only the .sdata section has + relocs. This is called via bfd_map_over_sections. */ + +static void +check_sections (abfd, sec, sdatasec) + bfd *abfd; + asection *sec; + PTR sdatasec; +{ + if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0 + && sec != (asection *) sdatasec + && sec->reloc_count != 0) + einfo ("%F%X: section %s has relocs; can not use --embedded-relocs", + abfd, bfd_get_section_name (abfd, sec)); +} + +/* This function is called after the section sizes and offsets have + been set. If we are generating embedded relocs, it calls a special + BFD backend routine to do the work. */ + +static void +gldmipsidt_after_allocation () +{ + bfd *abfd; + + if (! command_line.embedded_relocs + || link_info.relocateable) + return; + + for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next) + { + asection *datasec, *relsec; + char *errmsg; + + datasec = bfd_get_section_by_name (abfd, ".sdata"); + + if (datasec == NULL || datasec->reloc_count == 0) + continue; + + relsec = bfd_get_section_by_name (abfd, ".rel.sdata"); + ASSERT (relsec != NULL); + + if (! bfd_mips_ecoff_create_embedded_relocs (abfd, &link_info, + datasec, relsec, + &errmsg)) + { + if (errmsg == NULL) + einfo ("%B%X: can not create runtime reloc information: %E", + abfd); + else + einfo ("%X%B: can not create runtime reloc information: %s", + abfd, errmsg); + } + } +} + +static char * +gldmipsidt_get_script(isfile) + int *isfile; +{ + *isfile = 0; + + if (link_info.relocateable == true && config.build_constructors == true) + return +concat( +"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\ + \"ecoff-littlemips\")\n\ + SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\ +ENTRY(start)\n\ +SECTIONS\n\ +{\n\ + .text : {\n\ + ;\n\ + *(.init)\n\ + ;\n\ + *(.text)\n\ + *(.rel.sdata)\n\ + *(.fini)\n\ + ;\n\ + ;\n\ + }\n\ + "," .rdata : {\n\ + *(.rdata)\n\ + }\n\ + .data : {\n\ + *(.data)\n\ + CONSTRUCTORS\n\ + }\n\ + .lit8 : {\n\ + *(.lit8)\n\ + }\n\ + .lit4 : {\n\ + *(.lit4)\n\ + }\n\ + "," .sdata : {\n\ + *(.sdata)\n\ + }\n\ + .sbss : {\n\ + *(.sbss)\n\ + *(.scommon)\n\ + }\n\ + .bss : {\n\ + *(.bss)\n\ + *(COMMON)\n\ + }\n\ +}\n\n", NULL) + ; else if (link_info.relocateable == true) return +"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\ + \"ecoff-littlemips\")\n\ + SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\ +ENTRY(start)\n\ +SECTIONS\n\ +{\n\ + .text : {\n\ + ;\n\ + *(.init)\n\ + ;\n\ + *(.text)\n\ + *(.rel.sdata)\n\ + *(.fini)\n\ + ;\n\ + ;\n\ + }\n\ + .rdata : {\n\ + *(.rdata)\n\ + }\n\ + .data : {\n\ + *(.data)\n\ + }\n\ + .lit8 : {\n\ + *(.lit8)\n\ + }\n\ + .lit4 : {\n\ + *(.lit4)\n\ + }\n\ + .sdata : {\n\ + *(.sdata)\n\ + }\n\ + .sbss : {\n\ + *(.sbss)\n\ + *(.scommon)\n\ + }\n\ + .bss : {\n\ + *(.bss)\n\ + *(COMMON)\n\ + }\n\ +}\n\n" + ; else if (!config.text_read_only) return +concat( +"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\ + \"ecoff-littlemips\")\n\ + SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\ +ENTRY(start)\n\ +SECTIONS\n\ +{\n\ + . = 0xa0012000;\n\ + .text : {\n\ + _ftext = . ;\n\ + *(.init)\n\ + eprol = .;\n\ + *(.text)\n\ + PROVIDE (__runtime_reloc_start = .);\n\ + *(.rel.sdata)\n\ + PROVIDE (__runtime_reloc_stop = .);\n\ + *(.fini)\n\ + etext = .;\n\ + _etext = .;\n\ +"," }\n\ + . = .;\n\ + .rdata : {\n\ + *(.rdata)\n\ + }\n\ + _fdata = ALIGN(16);\n\ + .data : {\n\ + *(.data)\n\ + CONSTRUCTORS\n\ + }\n\ + _gp = ALIGN(16) + 0x8000;\n\ + .lit8 : {\n\ + *(.lit8)\n\ + }\n\ + .lit4 : {\n\ + *(.lit4)\n\ + }\n\ + .sdata : {\n\ + *(.sdata)\n\ + }\n\ +"," edata = .;\n\ + _edata = .;\n\ + _fbss = .;\n\ + .sbss : {\n\ + *(.sbss)\n\ + *(.scommon)\n\ + }\n\ + .bss : {\n\ + *(.bss)\n\ + *(COMMON)\n\ + }\n\ + end = .;\n\ + _end = .;\n\ +}\n\n" +, NULL) + ; else if (!config.magic_demand_paged) return +concat ( +"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\ + \"ecoff-littlemips\")\n\ + SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\ +ENTRY(start)\n\ +SECTIONS\n\ +{\n\ + . = 0xa0012000;\n\ + .text : {\n\ + _ftext = . ;\n\ + *(.init)\n\ + eprol = .;\n\ + *(.text)\n\ + PROVIDE (__runtime_reloc_start = .);\n\ + *(.rel.sdata)\n\ + PROVIDE (__runtime_reloc_stop = .);\n\ + *(.fini)\n\ + etext = .;\n\ + _etext = .;\n\ + "," }\n\ + . = .;\n\ + .rdata : {\n\ + *(.rdata)\n\ + }\n\ + _fdata = ALIGN(16);\n\ + .data : {\n\ + *(.data)\n\ + CONSTRUCTORS\n\ + }\n\ + _gp = ALIGN(16) + 0x8000;\n\ + .lit8 : {\n\ + *(.lit8)\n\ + "," }\n\ + .lit4 : {\n\ + *(.lit4)\n\ + }\n\ + .sdata : {\n\ + *(.sdata)\n\ + }\n\ + edata = .;\n\ + _edata = .;\n\ + _fbss = .;\n\ + .sbss : {\n\ + *(.sbss)\n\ + *(.scommon)\n\ + "," }\n\ + .bss : {\n\ + *(.bss)\n\ + *(COMMON)\n\ + }\n\ + end = .;\n\ + _end = .;\n\ +}\n\n" +, NULL) + ; else return +concat ( +"OUTPUT_FORMAT(\"ecoff-bigmips\", \"ecoff-bigmips\",\n\ + \"ecoff-littlemips\")\n\ + SEARCH_DIR(/usr/local/mips-idt-ecoff/lib);\n\ +ENTRY(start)\n\ +SECTIONS\n\ +{\n\ + . = 0xa0012000;\n\ + .text : {\n\ + _ftext = . ;\n\ + *(.init)\n\ + eprol = .;\n\ + *(.text)\n\ + PROVIDE (__runtime_reloc_start = .);\n\ + *(.rel.sdata)\n\ + PROVIDE (__runtime_reloc_stop = .);\n\ + *(.fini)\n\ + etext = .;\n\ + _etext = .;\n\ + "," }\n\ + . = .;\n\ + .rdata : {\n\ + *(.rdata)\n\ + }\n\ + _fdata = ALIGN(16);\n\ + .data : {\n\ + *(.data)\n\ + CONSTRUCTORS\n\ + }\n\ + _gp = ALIGN(16) + 0x8000;\n\ + .lit8 : {\n\ + *(.lit8)\n\ + }\n\ + .lit4 : {\n\ + *(.lit4)\n\ + "," }\n\ + .sdata : {\n\ + *(.sdata)\n\ + }\n\ + edata = .;\n\ + _edata = .;\n\ + _fbss = .;\n\ + .sbss : {\n\ + *(.sbss)\n\ + *(.scommon)\n\ + }\n\ + .bss : {\n\ + *(.bss)\n\ + *(COMMON)\n\ + }\n\ + end = .;\n\ + _end = .;\n\ +}\n\n" +, NULL) +; } + +struct ld_emulation_xfer_struct ld_mipsidt_emulation = +{ + gldmipsidt_before_parse, + syslib_default, + hll_default, + after_parse_default, + gldmipsidt_after_open, + gldmipsidt_after_allocation, + set_output_arch_default, + ldemul_default_target, + before_allocation_default, + gldmipsidt_get_script, + "mipsidt", + "ecoff-bigmips" +}; diff --git a/ld/mpw-make.in b/ld/mpw-make.in index d268e83..0e1361c 100644 --- a/ld/mpw-make.in +++ b/ld/mpw-make.in @@ -76,7 +76,7 @@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi RANLIB = ranlib CC_FOR_BUILD={CC} -BISON = bison -y +BISON = byacc LEX = flex # Seach path to override the default search path for -lfoo libraries. @@ -178,20 +178,17 @@ ALL_CFLAGS={INCLUDES} {HDEFINES} {TDEFINES} {CDEFINES} {CFLAGS} BFDLIB = ::bfd:libbfd.o LIBIBERTY = ::libiberty:libiberty.o -ALL_EMULATIONS = "{o}"em_lnk960.c.o "{o}"em_sun3.c.o "{o}"em_i386aout.c.o "{o}"em_go32.c.o "{o}"em_vsta.c.o \Option-d - "{o}"em_m88kbcs.c.o "{o}"em_a29k.c.o "{o}"em_news.c.o "{o}"em_hp300bsd.c.o "{o}"em_hp3hpux.c.o \Option-d - "{o}"em_h8300.c.o "{o}"em_h8300h.c.o "{o}"em_ebmon29k.c.o "{o}"em_sun4.c.o "{o}"em_gld960.c.o \Option-d - "{o}"em_m68kcoff.c.o "{o}"em_st2000.c.o "{o}"em_sa29200.c.o "{o}"em_i386mach.c.o \Option-d - "{o}"em_vanilla.c.o "{o}"em_i386coff.c.o "{o}"em_z8ksim.c.o "{o}"em_mipslit.c.o "{o}"em_i386bsd.c.o \Option-d - "{o}"em_mipsbig.c.o "{o}"em_mipsbsd.c.o "{o}"em_mipsidt.c.o "{o}"em_vax.c.o "{o}"em_h8500.c.o \Option-d - "{o}"em_hppaosf.c.o "{o}"em_mipsidtl.c.o "{o}"em_sh.c.o "{o}"em_elf_i386.c.o "{o}"em_alpha.c.o \Option-d - "{o}"em_i386lynx.c.o "{o}"em_m68klynx.c.o "{o}"em_sparclynx.c.o "{o}"em_coff_sparc.c.o \Option-d - "{o}"em_delta68.c.o \Option-d +ALL_EMULATIONS = "{o}"elnk960.c.o "{o}"esun3.c.o "{o}"ei386aout.c.o "{o}"ego32.c.o "{o}"evsta.c.o \Option-d + "{o}"em88kbcs.c.o "{o}"ea29k.c.o "{o}"enews.c.o "{o}"ehp300bsd.c.o "{o}"ehp3hpux.c.o \Option-d + "{o}"eh8300.c.o "{o}"eh8300h.c.o "{o}"eebmon29k.c.o "{o}"esun4.c.o "{o}"egld960.c.o \Option-d + "{o}"em68kcoff.c.o "{o}"est2000.c.o "{o}"esa29200.c.o "{o}"ei386mach.c.o \Option-d + "{o}"evanilla.c.o "{o}"ei386coff.c.o "{o}"ez8ksim.c.o "{o}"emipslit.c.o "{o}"ei386bsd.c.o \Option-d + "{o}"emipsbig.c.o "{o}"emipsbsd.c.o "{o}"emipsidt.c.o "{o}"evax.c.o "{o}"eh8500.c.o \Option-d + "{o}"ehppaosf.c.o "{o}"emipsidtl.c.o "{o}"esh.c.o "{o}"eelf_i386.c.o "{o}"ealpha.c.o \Option-d + "{o}"ei386lynx.c.o "{o}"em68klynx.c.o "{o}"esparclynx.c.o "{o}"ecoff_sparc.c.o \Option-d + "{o}"edelta68.c.o \Option-d {OTHER_EMULATIONS} -# This is now set by configure.in. -EMULATION_OFILES = "{o}"em_mipsidt.c.o - CFILES = "{s}"ldctor.c "{s}"ldemul.c "{s}"ldexp.c "{s}"ldfile.c "{s}"ldlang.c \Option-d ldmain.c "{s}"ldmisc.c "{s}"ldver.c "{s}"ldwrite.c "{s}"lexsup.c \Option-d mri.c @@ -208,22 +205,25 @@ OFILES = "{o}"ldgram.c.o "{o}"ldlex.c.o "{o}"lexsup.c.o "{o}"ldlang.c.o "{o}"mri "{o}"ldwrite.c.o "{o}"ldexp.c.o "{o}"ldemul.c.o "{o}"ldver.c.o "{o}"ldmisc.c.o \Option-d "{o}"ldfile.c.o {EMULATION_OFILES} -LINTSOURCES = {CFILES} {GENERATED_CFILES} em_\Option-x.c +LINTSOURCES = {CFILES} {GENERATED_CFILES} e\Option-x.c -STAGESTUFF = "{o}"\Option-x.c.o ldscripts:\Option-x em_\Option-x.c {GENERATED_CFILES} {GENERATED_HFILES} +STAGESTUFF = "{o}"\Option-x.c.o ldscripts:\Option-x e\Option-x.c {GENERATED_CFILES} {GENERATED_HFILES} info \Option-f ld.info # .PHONY \Option-f info -:ldgram.h :ldgram.c \Option-f "{s}"ldgram.y +:ldgram.c \Option-f "{s}"ldgram.y {BISON} {BISONFLAGS} -d "{srcdir}"ldgram.y Rename -y y.tab.c :ldgram.c Rename -y y.tab.h :ldgram.h +# Separate from ldgram.c so that a parallel make doesn't try to build +# both ldgram.c and ldgram.h simultaneously. +:ldgram.h \Option-f :ldgram.c + # EMUL is the name of a file in the emulparams subdir, without the .sh. "{o}"ldmain.c.o \Option-f "{s}"ldmain.c config.status {CC} {INCLUDES} {HDEFINES} {TDEFINES} {CDEFINES} -d DEFAULT_EMULATION=\Option-d"{EMUL}\Option-d" -d SCRIPTDIR=\Option-d"{scriptdir}\Option-d" {CFLAGS} "{s}"ldmain.c -o "{o}"ldmain.c.o - fi # Use this when flex is working correctly. :ldlex.c \Option-f "{s}"ldlex.l @@ -234,135 +234,168 @@ info \Option-f ld.info #:ldlex.c \Option-f "{s}"mpw-ldlex.c # Catenate "{s}"mpw-ldlex.c >:ldlex.c -# These all start with em_ so 'make clean' can find them. +# These all start with e so 'make clean' can find them. GENSCRIPTS = {SHELL} "{srcdir}"genscripts.sh {srcdir} {libdir} {host_alias} {target_alias} {EMUL} "{NATIVE_LIB_DIRS}" GEN_DEPENDS = "{srcdir}"genscripts.sh -em_sun4.c \Option-f "{srcdir}"emulparams:sun4.sh \Option-d +esun4.c \Option-f "{srcdir}"emulparams:sun4.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} sun4 -em_sun3.c \Option-f "{srcdir}"emulparams:sun3.sh \Option-d +esun3.c \Option-f "{srcdir}"emulparams:sun3.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} sun3 -em_vsta.c \Option-f "{srcdir}"emulparams:vsta.sh \Option-d +evsta.c \Option-f "{srcdir}"emulparams:vsta.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} vsta -em_go32.c \Option-f "{srcdir}"emulparams:go32.sh \Option-d +ego32.c \Option-f "{srcdir}"emulparams:go32.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} go32 -em_news.c \Option-f "{srcdir}"emulparams:news.sh \Option-d +enews.c \Option-f "{srcdir}"emulparams:news.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} news -em_vax.c \Option-f "{srcdir}"emulparams:vax.sh \Option-d +evax.c \Option-f "{srcdir}"emulparams:vax.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} vax -em_hp300bsd.c \Option-f "{srcdir}"emulparams:hp300bsd.sh \Option-d +ehp300bsd.c \Option-f "{srcdir}"emulparams:hp300bsd.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} hp300bsd -em_hp3hpux.c \Option-f "{srcdir}"emulparams:hp3hpux.sh \Option-d +ehp3hpux.c \Option-f "{srcdir}"emulparams:hp3hpux.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} hp3hpux -em_hppaosf.c \Option-f "{srcdir}"emulparams:hppaosf.sh \Option-d +ehppaosf.c \Option-f "{srcdir}"emulparams:hppaosf.sh \Option-d "{srcdir}"emultempl:hppaosf.em "{srcdir}"scripttempl:hppaosf.sc {GEN_DEPENDS} {GENSCRIPTS} hppaosf -em_i386aout.c \Option-f "{srcdir}"emulparams:i386aout.sh \Option-d +ei386aout.c \Option-f "{srcdir}"emulparams:i386aout.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} i386aout -em_i386mach.c \Option-f "{srcdir}"emulparams:i386mach.sh \Option-d +ei386mach.c \Option-f "{srcdir}"emulparams:i386mach.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} i386mach -em_ebmon29k.c \Option-f "{srcdir}"emulparams:ebmon29k.sh \Option-d +eebmon29k.c \Option-f "{srcdir}"emulparams:ebmon29k.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:ebmon29k.sc {GEN_DEPENDS} {GENSCRIPTS} ebmon29k -em_sa29200.c \Option-f "{srcdir}"emulparams:sa29200.sh \Option-d +esa29200.c \Option-f "{srcdir}"emulparams:sa29200.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:sa29200.sc {GEN_DEPENDS} {GENSCRIPTS} sa29200 -em_a29k.c \Option-f "{srcdir}"emulparams:a29k.sh \Option-d +ea29k.c \Option-f "{srcdir}"emulparams:a29k.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:a29k.sc {GEN_DEPENDS} {GENSCRIPTS} a29k -em_m88kbcs.c \Option-f "{srcdir}"emulparams:m88kbcs.sh \Option-d +em88kbcs.c \Option-f "{srcdir}"emulparams:m88kbcs.sh \Option-d "{srcdir}"emultempl:m88kbcs.em "{srcdir}"scripttempl:m88kbcs.sc {GEN_DEPENDS} {GENSCRIPTS} m88kbcs -em_h8300.c \Option-f "{srcdir}"emulparams:h8300.sh \Option-d +eh8300.c \Option-f "{srcdir}"emulparams:h8300.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:h8300.sc {GEN_DEPENDS} {GENSCRIPTS} h8300 -em_h8300h.c \Option-f "{srcdir}"emulparams:h8300h.sh \Option-d +eh8300h.c \Option-f "{srcdir}"emulparams:h8300h.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:h8300h.sc {GEN_DEPENDS} {GENSCRIPTS} h8300h -em_h8500.c \Option-f "{srcdir}"emulparams:h8500.sh \Option-d +eh8500.c \Option-f "{srcdir}"emulparams:h8500.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:h8500.sc {GEN_DEPENDS} {GENSCRIPTS} h8500 -em_sh.c \Option-f "{srcdir}"emulparams:sh.sh \Option-d +esh.c \Option-f "{srcdir}"emulparams:sh.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:sh.sc {GEN_DEPENDS} {GENSCRIPTS} sh -em_st2000.c \Option-f "{srcdir}"emulparams:st2000.sh \Option-d +est2000.c \Option-f "{srcdir}"emulparams:st2000.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:st2000.sc {GEN_DEPENDS} {GENSCRIPTS} st2000 -em_z8ksim.c \Option-f "{srcdir}"emulparams:z8ksim.sh \Option-d +ez8ksim.c \Option-f "{srcdir}"emulparams:z8ksim.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:z8ksim.sc {GEN_DEPENDS} {GENSCRIPTS} z8ksim -em_vanilla.c \Option-f "{srcdir}"emulparams:vanilla.sh \Option-d +evanilla.c \Option-f "{srcdir}"emulparams:vanilla.sh \Option-d "{srcdir}"emultempl:vanilla.em "{srcdir}"scripttempl:vanilla.sc {GEN_DEPENDS} {GENSCRIPTS} vanilla -em_lnk960.c \Option-f "{srcdir}"emulparams:lnk960.sh \Option-d +elnk960.c \Option-f "{srcdir}"emulparams:lnk960.sh \Option-d "{srcdir}"emultempl:lnk960.em "{srcdir}"scripttempl:i960.sc {GEN_DEPENDS} {GENSCRIPTS} lnk960 -em_gld960.c \Option-f "{srcdir}"emulparams:gld960.sh \Option-d +egld960.c \Option-f "{srcdir}"emulparams:gld960.sh \Option-d "{srcdir}"emultempl:gld960.em "{srcdir}"scripttempl:i960.sc {GEN_DEPENDS} {GENSCRIPTS} gld960 -em_m68kcoff.c \Option-f "{srcdir}"emulparams:m68kcoff.sh \Option-d +em68kcoff.c \Option-f "{srcdir}"emulparams:m68kcoff.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:m68kcoff.sc {GEN_DEPENDS} {GENSCRIPTS} m68kcoff -em_delta68.c \Option-f "{srcdir}"emulparams:delta68.sh \Option-d +edelta68.c \Option-f "{srcdir}"emulparams:delta68.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:delta68.sc {GEN_DEPENDS} {GENSCRIPTS} delta68 -em_m68klynx.c \Option-f "{srcdir}"emulparams:m68klynx.sh \Option-d +em68klynx.c \Option-f "{srcdir}"emulparams:m68klynx.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:m68kcoff.sc {GEN_DEPENDS} {GENSCRIPTS} m68klynx -em_i386coff.c \Option-f "{srcdir}"emulparams:i386coff.sh \Option-d +ei386coff.c \Option-f "{srcdir}"emulparams:i386coff.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:i386coff.sc {GEN_DEPENDS} {GENSCRIPTS} i386coff -em_i386lynx.c \Option-f "{srcdir}"emulparams:i386lynx.sh \Option-d +ei386lynx.c \Option-f "{srcdir}"emulparams:i386lynx.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:i386coff.sc {GEN_DEPENDS} {GENSCRIPTS} i386lynx -em_sparclynx.c \Option-f "{srcdir}"emulparams:sparclynx.sh \Option-d +esparclynx.c \Option-f "{srcdir}"emulparams:sparclynx.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:sparccoff.sc {GEN_DEPENDS} {GENSCRIPTS} sparclynx -em_mipslit.c \Option-f "{srcdir}"emulparams:mipslit.sh \Option-d +emipslit.c \Option-f "{srcdir}"emulparams:mipslit.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:mips.sc {GEN_DEPENDS} {GENSCRIPTS} mipslit -em_i386bsd.c \Option-f "{srcdir}"emulparams:i386bsd.sh \Option-d +ei386bsd.c \Option-f "{srcdir}"emulparams:i386bsd.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} i386bsd -em_mipsbig.c \Option-f "{srcdir}"emulparams:mipsbig.sh \Option-d +emipsbig.c \Option-f "{srcdir}"emulparams:mipsbig.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:mips.sc {GEN_DEPENDS} {GENSCRIPTS} mipsbig -em_mipsbsd.c \Option-f "{srcdir}"emulparams:mipsbsd.sh \Option-d +emipsbsd.c \Option-f "{srcdir}"emulparams:mipsbsd.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:aout.sc {GEN_DEPENDS} {GENSCRIPTS} mipsbsd -em_mipsidt.c \Option-f "{srcdir}"emulparams:mipsidt.sh \Option-d +emipsidt.c \Option-f "{srcdir}"emulparams:mipsidt.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:mips.sc {GEN_DEPENDS} {GENSCRIPTS} mipsidt -em_mipsidtl.c \Option-f "{srcdir}"emulparams:mipsidtl.sh \Option-d +emipsidtl.c \Option-f "{srcdir}"emulparams:mipsidtl.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:mips.sc {GEN_DEPENDS} {GENSCRIPTS} mipsidtl -em_elf_i386.c \Option-f "{srcdir}"emulparams:elf_i386.sh \Option-d +eelf_i386.c \Option-f "{srcdir}"emulparams:elf_i386.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:elf.sc {GEN_DEPENDS} {GENSCRIPTS} elf_i386 -em_elf32mipb.c \Option-f "{srcdir}"emulparams:elf32mipb.sh \Option-d +eelf32mipb.c \Option-f "{srcdir}"emulparams:elf32mipb.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:elf.sc {GEN_DEPENDS} {GENSCRIPTS} elf32mipb -em_alpha.c \Option-f "{srcdir}"emulparams:alpha.sh \Option-d +ealpha.c \Option-f "{srcdir}"emulparams:alpha.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:alpha.sc {GEN_DEPENDS} {GENSCRIPTS} alpha -em_coff_sparc.c \Option-f "{srcdir}"emulparams:coff_sparc.sh \Option-d +ecoff_sparc.c \Option-f "{srcdir}"emulparams:coff_sparc.sh \Option-d "{srcdir}"emultempl:generic.em "{srcdir}"scripttempl:sparccoff.sc {GEN_DEPENDS} {GENSCRIPTS} coff_sparc -{LD_PROG} \Option-f {OFILES} {BFDLIB} {LIBIBERTY} +{LD_PROG} \Option-f {OFILES} {BFDLIB} {LIBIBERTY} "{o}"Version.r + Rez -rd -o {LD_PROG} "{o}"Version.r -append Link {LDFLAGS} -o {LD_PROG} {OFILES} {BFDLIB} {LIBIBERTY} {EXTRALIBS} +"{o}"Version.r \Option-f "{o}"version-stamp + +"{o}"version-stamp \Option-f Makefile + Delete -i -y "{o}"version.new "{o}"version-stamp + Set major `Search 'ld version ' {srcdir}ldver.c | sed -e 's/.*ld version [^0-9]*\([0-9]*\)\.\([0-9]*\)\..*/\1/'` + Set minor `Search 'ld version ' {srcdir}ldver.c | sed -e 's/.*ld version [^0-9]*\([0-9]*\)\.\([0-9]*\)\..*/\2/'` + Set release 0 + Echo '/* Version resources. */' > "{o}"version.new + Echo '#include "SysTypes.r"' >> "{o}"version.new + Echo '' >> "{o}"version.new + Echo "resource 'vers' (1) " `open-brace` >> "{o}"version.new + Echo " {major}," >> "{o}"version.new + Echo " {minor}," >> "{o}"version.new + Echo " {release}," >> "{o}"version.new + Echo ' 0,' >> "{o}"version.new + Echo ' verUs,' >> "{o}"version.new + Echo ' "{version}",' >> "{o}"version.new + Echo ' "{version} (c) 1986-95 FSF, Inc. "' >> "{o}"version.new + Echo '};' >> "{o}"version.new + Echo '' >> "{o}"version.new + Echo "resource 'vers' (2, purgeable) " `open-brace` >> "{o}"version.new + Echo " {major}," >> "{o}"version.new + Echo " {minor}," >> "{o}"version.new + Echo " {release}," >> "{o}"version.new + Echo ' 0,' >> "{o}"version.new + Echo ' verUs,' >> "{o}"version.new + Echo ' "{version}",' >> "{o}"version.new + Echo ' "GNU LD for MPW"' >> "{o}"version.new + Echo '};' >> "{o}"version.new + MoveIfChange "{o}"version.new "{o}"Version.r + Echo ' ' > "{o}"version-stamp + # The generated emulation files mostly have the same dependencies. {EMULATION_OFILES} \Option-f ::bfd:bfd.h ::bfd:sysdep.h "{INCDIR}":bfdlink.h \Option-d "{s}"ld.h "{s}"ldmain.h "{s}"ldemul.h "{s}"ldfile.h "{s}"ldmisc.h "{s}"ldexp.h "{s}"ldlang.h "{s}"config.h "{s}"ldctor.h |