2009-09-01 Tristan Gingold <gingold@adacore.com>
authorTristan Gingold <gingold@adacore.com>
Tue, 1 Sep 2009 13:10:45 +0000 (13:10 +0000)
committerTristan Gingold <gingold@adacore.com>
Tue, 1 Sep 2009 13:10:45 +0000 (13:10 +0000)
* makefile.vms: Ported to Itanium VMS.  Remove useless variable and
dependencies.  Reindent.
* configure.com: Ported to Itanium VMS.  Now generates a build.com
to build without make.  Add messages but make edit silent.
* hosts/alphavms.h: Add a prototype for stpcpy.
* vms.c: Add a missing include for Alpha VMS.
* elfxx-ia64.c (ELF_OSABI): Define for OpenVMS.

bfd/ChangeLog
bfd/configure.com
bfd/elfxx-ia64.c
bfd/hosts/alphavms.h
bfd/makefile.vms
bfd/vms.c

index 8b51b177e396dadb24d70383f6ab54001433c8a4..89d77b982fdf26ff5aa22579679ed8efaca7d17b 100644 (file)
@@ -1,3 +1,13 @@
+2009-09-01  Tristan Gingold  <gingold@adacore.com>
+
+       * makefile.vms: Ported to Itanium VMS.  Remove useless variable and
+       dependencies.  Reindent.
+       * configure.com: Ported to Itanium VMS.  Now generates a build.com
+       to build without make.  Add messages but make edit silent.
+       * hosts/alphavms.h: Add a prototype for stpcpy.
+       * vms.c: Add a missing include for Alpha VMS.
+       * elfxx-ia64.c (ELF_OSABI): Define for OpenVMS.
+
 2009-08-31  Jan Beulich  <jbeulich@novell.com>
 
        * elf-bfd.h (bfd_elf_get_default_section_type): Declare.
index de44dfc25ff248dd0df6086598e760631a22065c..04113aaa05b91af7beb26907932aa558a1cda731 100644 (file)
@@ -1,18 +1,22 @@
 $!
-$! This file configures the bfd library for use with openVMS (Alpha and Vax)
+$! This file configures the bfd library for use with openVMS.
 $!
 $! We do not use the configure script, since we do not have /bin/sh
 $! to execute it.
 $!
 $! Written by Klaus K"ampf (kkaempf@rmi.de)
+$! Rewritten by Tristan Gingold (gingold@adacore.com)
 $!
-$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1)      ! vax==1, alpha==2
-$arch = f$element(arch_indx,"|","|VAX|Alpha|")
+$ arch=F$GETSYI("ARCH_NAME")
+$ arch=F$EDIT(arch,"LOWERCASE")
+$if arch .eqs. "alpha" then target = "alpha"
+$if arch .eqs. "ia64" then target = "ia64"
 $!
-$if arch .eqs. "Alpha"
+$if (arch .eqs. "alpha") .or. (arch .eqs. "ia64")
 $then
-$ write sys$output "Configuring for Alpha target"
-$ target = "alpha"
+$!
+$ write sys$output "Configuring BFD for ''target' target"
+$!
 $!
 $! copy bfd-in2.h to bfd.h, replacing @ macros
 $!
@@ -23,6 +27,7 @@ $DECK
 !  Copy file, changing lines with macros (@@)
 !
 !
+   set (success,off);
    vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
    match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
@@ -111,6 +116,12 @@ $DECK
       ERASE(match_pos);
       COPY_TEXT('bfd_vma ufile_ptr');
    ENDIF;
+   match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
+   IF match_pos <> 0 THEN;
+      POSITION(BEGINNING_OF(match_pos));
+      ERASE(match_pos);
+      COPY_TEXT('0');
+   ENDIF;
    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
    QUIT
 $  EOD
@@ -122,6 +133,7 @@ $ target = "vax"
 $!
 $! copy bfd-in2.h to bfd.h, replacing @ macros
 $!
+$ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
         []bfd-in2.h /output=[]bfd.h
 $DECK
@@ -129,6 +141,7 @@ $DECK
 !  Copy file, changing lines with macros (@@)
 !
 !
+   set (success,off);
    vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
    match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
@@ -186,10 +199,10 @@ $DECK
 $  EOD
 $endif
 $
-$ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
 $!
 $! create bfdver.h
 $!
+$ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
         []version.h /output=[]bfdver.h
 $DECK
@@ -197,6 +210,7 @@ $DECK
 !  Copy file, changing lines with macros (@@)
 !
 !
+   set (success,off);
    vfile := CREATE_BUFFER("vfile", "configure.in");
    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
    match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
@@ -241,11 +255,11 @@ $DECK
    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
    QUIT
 $  EOD
-$ write sys$output "Generated `bfdver.h' from 'version.h' and `configure.in'."
 $!
 $!
 $! create targmatch.h
 $!
+$ write sys$output "Generate `targmatch.h'"
 $ open/write tfile []targmatch.h
 $ write tfile "{ """ + target + "-*-*vms*""" + ","
 $ write tfile "#if defined (SELECT_VECS)"
@@ -255,11 +269,11 @@ $ write tfile "UNSUPPORTED_TARGET"
 $ write tfile "#endif"
 $ write tfile "},"
 $ close tfile
-$ write sys$output "Generated `targmatch.h'"
 $!
 $!
 $! create config.h
 $!
+$ write sys$output "Generate `config.h'"
 $ create []config.h
 /* config.h-vms.  Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de.  */
 /* config.in.  Generated automatically from configure.in by autoheader.  */
@@ -304,5 +318,88 @@ $ create []config.h
 /* Disable NLS  */
 #undef ENABLE_NLS
 $!
-$ write sys$output "Generated `config.h'"
+$ write sys$output "Generate build.com"
+$!
+$ if ARCH.eqs."alpha"
+$ then
+$   create build.com
+$DECK
+$ DEFS="""SELECT_VECS=&vms_alpha_vec"","+-
+  """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
+$ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
+$EOD
+$ endif
+$ if ARCH.eqs."ia64"
+$ then
+$   create build.com
+$DECK
+$ DEFS="""SELECT_VECS=&bfd_elf64_ia64_vms_vec"","+-
+  """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
+$ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
+  "elflink,elf-attrs,dwarf1,elf64,"
+$EOD
+$ create substxx.tpu
+$DECK
+   set (success,off);
+   file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
+   found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
 
+   LOOP
+     rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
+     match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
+     EXITIF match_pos = 0;
+     POSITION(BEGINNING_OF(match_pos));
+     ERASE(match_pos);
+     COPY_TEXT('64');
+   ENDLOOP;
+   WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
+   QUIT
+$  EOD
+$ write sys$output "Generate elf64-ia64.c from elfxx-ia64.c"
+$ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
+        []elfXX-ia64.c /output=[]elf64-ia64.c
+$ write sys$output "Generate elf64-target.h from elfxx-target.h"
+$ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
+        []elfXX-target.h /output=[]elf64-target.h
+$ del substxx.tpu;*
+$ copy [.hosts]alphavms.h sysdep.h
+$ endif
+$ append sys$input build.com
+$DECK
+$ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
+$ OPT="/noopt/debug"
+$ CFLAGS="/name=(as_is,shortened)" + -
+  "/include=([],""../"",""../include"")" + -
+  "/define=(" + DEFS + ")" + OPT
+$ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
+  "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
+  "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
+$ write sys$output "CFLAGS=",CFLAGS
+$ cflags_libbfd="/warning=(disable=missingreturn)"
+$ cflags_nil=""
+$ NUM = 0
+$ OBJS=""
+$ LOOP:
+$   F = F$ELEMENT(NUM,",",FILES)
+$   IF F.EQS."," THEN GOTO END
+$   eflags_name="cflags_''f'"
+$   name_len=f$length(eflags_name)
+$   dash_pos=f$locate("-",eflags_name)
+$   if dash_pos.ne.name_len
+$   then
+$     eflags_name['dash_pos,1]:="_"
+$     dash_pos=f$locate("-",eflags_name)
+$     if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
+$   endif
+$   if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
+$   eflags='eflags_name
+$   write sys$output "Compiling ", F, ".c", eflags
+$   cc 'CFLAGS 'eflags 'F.c
+$   IF OBJS.NES."" THEN OBJS=OBJS + ","
+$   OBJS=OBJS + F + ".obj"
+$   NUM = NUM + 1
+$   GOTO LOOP
+$ END:
+$ purge
+$ lib/create libbfd 'OBJS
+$EOD
index b43eb12057f1655f98aff35f63b2a905fc9ff89d..ff5b6f501302727fa13f4cbee594a48a0baf4109 100644 (file)
@@ -6031,6 +6031,9 @@ elfNN_vms_close_and_cleanup (bfd *abfd)
 
 #undef  elf_backend_want_p_paddr_set_to_zero
 
+#undef ELF_OSABI
+#define ELF_OSABI                      ELFOSABI_OPENVMS
+
 #undef  ELF_MAXPAGESIZE
 #define ELF_MAXPAGESIZE                        0x10000 /* 64KB */
 
index 0afda86e6f4355125951d758a051decd56df284f..c94207b4598c6f9a67ffb1db5688526ffa6a94a9 100644 (file)
@@ -67,7 +67,8 @@ typedef BFD_HOST_64_BIT int64_type;
 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
 #endif
 
-extern int getpagesize PARAMS ((void));
+extern int getpagesize (void);
+extern char *stpcpy (char *, const char *);
 
 /* No intl.  */
 #define gettext(Msgid) (Msgid)
index bebb8e9da08484991b34c07d550ac47454dda7e2..836909858748e6b7866ec7b240e331b1963d1d78 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Makefile for bfd library under openVMS (Alpha and Vax)
+# Makefile for bfd library under openVMS 
 #
 # For use with gnu-make for vms
 #
@@ -7,60 +7,43 @@
 #
 #
 
-CC=cc
-
+ifeq ($(ARCH),IA64)
+HOSTFILE=alphavms.h
+OBJS:=cpu-ia64.obj,elf64-ia64.obj,elf-strtab.obj,corefile.obj,stabs.obj,\
+  merge.obj,elf-eh-frame.obj,elflink.obj,elf-attrs.obj,dwarf1.obj,elf64.obj
+DEFS=SELECT_VECS="&bfd_elf64_ia64_vms_vec",SELECT_ARCHITECTURES="&bfd_ia64_arch"
+endif
 ifeq ($(ARCH),ALPHA)
 HOSTFILE=alphavms.h
-TARGETOBJS = cpu-alpha.obj
-else
+OBJS:=vms.obj,vms-hdr.obj,vms-gsd.obj,vms-tir.obj,vms-misc.obj,cpu-alpha.obj
+DEFS=SELECT_VECS="&vms_alpha_vec",SELECT_ARCHITECTURES="&bfd_alpha_arch"
+endif
+ifeq ($(ARCH),VAX)
 HOSTFILE=vaxvms.h
-TARGETOBJS = cpu-vax.obj
+OBJS:=vms.obj,vms-hdr.obj,vms-gsd.obj,vms-tir.obj,vms-misc.obj,cpu-vax.obj
+DEFS=SELECT_VECS="&vms_vax_vec",SELECT_ARCHITECTURES="&bfd_vax_arch"
 endif
 
-
-OBJS=archive.obj,archive64.obj,archures.obj,bfd.obj,bfdio.obj,binary.obj,\
-  cache.obj,coffgen.obj,compress.obj,corefile.obj,dwarf2.obj,elf.obj,\
-  format.obj,hash.obj,ihex.obj,init.obj,libbfd.obj,linker.obj,opncls.obj,\
-  reloc.obj,section.obj,simple.obj,srec.obj,stab-syms.obj,syms.obj,\
-  targets.obj,tekhex.obj,verilog.obj,\
-  vms.obj,vms-hdr.obj,vms-gsd.obj,vms-tir.obj,vms-misc.obj,$(TARGETOBJS)
+OBJS:=$(OBJS),archive.obj,archive64.obj,archures.obj,bfd.obj,bfdio.obj,\
+  binary.obj,cache.obj,coffgen.obj,compress.obj,corefile.obj,dwarf2.obj,\
+  elf.obj,format.obj,hash.obj,ihex.obj,init.obj,libbfd.obj,linker.obj,\
+  opncls.obj,reloc.obj,section.obj,simple.obj,srec.obj,stab-syms.obj,\
+  syms.obj,targets.obj,tekhex.obj,verilog.obj
 
 ifeq ($(CC),gcc)
-ifeq ($(ARCH),ALPHA)
-DEFS=/define=(SELECT_VECS="&vms_alpha_vec",SELECT_ARCHITECTURES="&bfd_alpha_arch",\
-"HAVE_vms_alpha_vec=1")
-else
-DEFS=/define=(SELECT_VECS="&vms_vax_vec",SELECT_ARCHITECTURES="&bfd_vax_arch",\
-"HAVE_vms_vax_vec=1")
-endif
 CFLAGS=/include=([],[-.include])$(DEFS)
 else
-ifeq ($(ARCH),ALPHA)
-DEFS=/define=(SELECT_VECS="&vms_alpha_vec",\
-  SELECT_ARCHITECTURES="&bfd_alpha_arch",\
-  "HAVE_vms_alpha_vec=1","unlink=remove","DEBUGDIR=NULL")
-else
-DEFS=/define=(SELECT_VECS="&vms_vax_vec",SELECT_ARCHITECTURES="&bfd_vax_arch",\
-  "HAVE_vms_vax_vec=1","unlink=remove")
-endif
 OPT=/noopt/debug
-CFLAGS=/name=(as_is,shortened)/include=([],[-.include])$(DEFS)$(OPT)
+CFLAGS=/name=(as_is,shortened)/include=([],"../include")\
+ /define=("unlink=remove",DEBUGDIR="""GNU$$DEBUGDIR:""",$(DEFS))$(OPT)
 endif
 
-
-libbfd.olb: sysdep.h bfd.h $(OBJS)
+libbfd.olb: $(OBJS)
        purge
        lib/create libbfd $(OBJS)
 
-sysdep.h: [.hosts]$(HOSTFILE) config.h
-       $(CP) $< $@
-
-bfd.h: bfd-in2.h
-       $$ @configure
-
 targmatch.h: bfd.h
 config.h: bfd.h
-
 vms.c: vms.h
 vms-mhd.c: vms.h
 vms-gsd.c: vms.h
@@ -71,8 +54,4 @@ targets.c: targmatch.h
 clean:
        $$ purge
        $(RM) libbfd.olb;
-       $(RM) sysdep.h;
-       $(RM) bfd.h;
-       $(RM) targmatch.h;
-       $(RM) config.h;
        $(RM) *.obj;
index 5bb60af9708e69deb946115022265b0b160a5836..61f485ed683e2a7bb1ecb7362d9e5de93f0502aa 100644 (file)
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -24,6 +24,7 @@
 
 #ifdef VMS
 #include <rms.h>
+#include <unixlib.h>
 #include <starlet.h>
 #define RME$C_SETRFM 0x00000001
 #include <unistd.h>