Patchwork : vms: map 'environ'

login
register
mail settings
Submitter Tristan Gingold
Date Dec. 16, 2011, 3:24 p.m.
Message ID <1E8635DB-7FED-4FC4-8822-E234B7C85022@adacore.com>
Download mbox | patch
Permalink /patch/131832/
State New
Headers show

Comments

Tristan Gingold - Dec. 16, 2011, 3:24 p.m.
Hi,

libiberty/pex-unix.c uses the global variable 'environ', which is available on VMS but with a DEC-C name.
This patch adds a translation for it in the VMS table.

Committed on trunk.

Tristan.

2011-12-16  Tristan Gingold  <gingold@adacore.com>

	* config/vms/vms.c (VMS_CRTL_GLOBAL): Define.
	(vms_patch_builtins): Handle.
	* config/vms/vms-crtlmap.map: Add an entry for environ.

Patch

Index: vms-crtlmap.map
===================================================================
--- vms-crtlmap.map	(revision 182402)
+++ vms-crtlmap.map	(working copy)
@@ -63,6 +63,7 @@ 
 ctime
 dup
 dup2
+environ       GLOBAL
 exit
 exp           FLOAT
 fabs          FLOAT
Index: vms.c
===================================================================
--- vms.c	(revision 182402)
+++ vms.c	(working copy)
@@ -45,6 +45,9 @@ 
 /* Prepend x before the name for printf like functions.  */
 #define VMS_CRTL_PRNTF	(1 << 4)
 
+/* Prepend ga_ for global data.  */
+#define VMS_CRTL_GLOBAL (1 << 5)
+
 struct vms_crtl_name
 {
   /* The standard C name.  */
@@ -123,6 +126,12 @@ 
           rlen += 9;
         }
 
+      if (n->flags & VMS_CRTL_GLOBAL)
+        {
+          memcpy (res + rlen, "ga_", 3);
+          rlen += 3;
+        }
+
       if (n->flags & VMS_CRTL_FLOAT)
         res[rlen++] = 't';