From a72f4e5f849dcc4b24e0ee3dfb2648cb974f409d Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Wed, 6 May 1992 01:07:05 +0000 Subject: * ldfile.c: merge in VMS filename support * ldmain.c (main): take out ./ from library path, and close file before unlinking. Make multiple defs of a symbol create an unexecable file. * ldmisc.c: fatal errosrs delete output file --- ld/descrip.mms | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ld/ldmain.c | 39 ++++++++++++++++++--------- 2 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 ld/descrip.mms (limited to 'ld') diff --git a/ld/descrip.mms b/ld/descrip.mms new file mode 100644 index 0000000000..e9487d1737 --- /dev/null +++ b/ld/descrip.mms @@ -0,0 +1,83 @@ +# mms file to build vms-i960 ld +# sac@cygnus.com + +.FIRST + @[-.deci960]define-gnu + + +CC = gcc +CFLAGS = /define=(VMS, LNK960_LITTLE) /cc1_options="-mvaxc-alignment" /inc=([],[-.include],[-.bfd], [-.include.aout]) + +all : ld.exe + copy descrip.mms all + +BFD_OBJ = [-.bfd]archive.obj, - + [-.bfd]coff-i960.obj, - + [-.bfd]format.obj, - + [-.bfd]reloc.obj, - + [-.bfd]archures.obj, - + [-.bfd]core.obj, - + [-.bfd]init.obj, - + [-.bfd]section.obj, - + [-.bfd]bfd.obj, - + [-.bfd]cpu-i960.obj, - + [-.bfd]libbfd.obj, - + [-.bfd]srec.obj, - + [-.bfd]cache.obj, - + [-.bfd]ctor.obj, - + [-.bfd]opncls.obj, - + [-.bfd]targets.obj, - + [-.bfd]syms.obj,- + [-.bfd]seclet.obj + +LIBIBERTY_OBJ = - +[]bzero.obj, getopt1.obj,obstack.obj,[-.libiberty]bcopy.obj,- +[-.libiberty]getopt.obj,[-.libiberty]index.obj,[-.libiberty]strdup.obj,alloca.obj + +LD_OBJ = - +cplus-dem.obj, - +ld__a29k.obj, - +ld__ebmon29k.obj, - +ld__gld960.obj, - +ld__go32.obj, - +ld__h8300hms.obj, - +ld__h8300xray.obj, - +ld__hp300bsd.obj, - +ld__i386aout.obj, - +ld__lnk960.obj, - +ld__m88kbcs.obj, - +ld__news.obj, - +ld__st2000.obj, - +ld__sun3.obj, - +ld__sun4.obj, - +ld__vanilla.obj, - +ldctor.obj, - +ldemul.obj, - +lderror.obj, - +ldexp.obj, - +ldfile.obj, - +ldgram.obj, - +ldindr.obj, - +ldlang.obj, - +ldlex.obj, - +ldmain.obj, - +ldsym.obj, - +ldver.obj, - +ldwarn.obj, - +ldmisc.obj,- +ldwrite.obj, - +lexsup.obj, - +mri.obj, - +relax.obj + + +LIBS=$(BFD_OBJ), $(LIBIBERTY_OBJ) + +ld.exe : $(LD_OBJ) + copy [-.libiberty]bzero.obj [] + copy [-.libiberty]getopt1.obj [] + copy [-.libiberty]obstack.obj [] + $(LINK)/exe=ld.exe $(LD_OBJ), $(LIBS) + + + diff --git a/ld/ldmain.c b/ld/ldmain.c index 62c7757c7e..774facc4ca 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -159,9 +159,9 @@ main (argc, argv) command_line.force_common_definition = false; init_bfd_error_vector(); -ldsym_init(); + ldsym_init(); ldfile_add_arch(""); - ldfile_add_library_path("./"); + config.make_executable = true; force_make_executable = false; @@ -176,7 +176,7 @@ ldsym_init(); config.text_read_only = true; config.make_executable = true; if (emulation == (char *)NULL) { - emulation= DEFAULT_EMULATION; + emulation= DEFAULT_EMULATION; } ldemul_choose_mode(emulation); @@ -237,18 +237,31 @@ ldsym_init(); ldwrite(); bfd_close(output_bfd); } - else { - output_bfd->flags |= EXEC_P; - ldwrite(); + else + { - if (config.make_executable == false && force_make_executable ==false) { + output_bfd->flags |= EXEC_P; - unlink(output_filename); - } - else { bfd_close(output_bfd); }; - exit (!config.make_executable); + ldwrite(); + + + if (config.make_executable == false && force_make_executable ==false) + { + printf("Link errors found, deleting executable %s\n", + output_filename); + if (output_bfd->iostream) + fclose(output_bfd->iostream); + + unlink(output_filename); + exit(1); } + else { + bfd_close(output_bfd); + } + } + + exit(0); } /* main() */ @@ -391,10 +404,10 @@ Q_enter_global_ref (nlist_p) asymbol ** stat_symbols = stat ? stat->asymbols:0; multiple_def_count++; - einfo("%C: multiple definition of `%T'\n", + einfo("%X%C: multiple definition of `%T'\n", sym->the_bfd, sym->section, stat1_symbols, sym->value, sym); - einfo("%C: first seen here\n", + einfo("%X%C: first seen here\n", sy->the_bfd, sy->section, stat_symbols, sy->value); } else { -- cgit v1.2.1