[Patch] add support for alpha/vms archives

h.becker becker.ismaning@freenet.de
Sat Apr 3 14:21:00 GMT 2010


> + /* Create module name from filename (ie, extract the basename and convert it
> +    in upper cases).  Works on both VMS and UNIX pathes.
> +    The result has to be free().  */
In VMS archives (object libraries) member names, aka module names, are 
independent of the filename. These names are set by the so called 
language processor, the compilers, etc. Many compilers by default use 
the filename, but sources can have a module directive to set a name. 
Some compilers use different default names, for example MACRO32 uses 
".MAIN.".
In general, module names build their own name space. For example, .MAIN. 
wouldn't be a legal filename on an ODS2 disks.
Also, although not often used, an object file can contain more than one 
object module.

So the module name should be extracted from the Module Header Record.

> + time_t
> + vms_time_to_time_t (unsigned int hi, unsigned int lo)
Is there any reason why binutils are not allowed to use "long long" and 
64-bit arithmetic?

> +   /* Check archive kind.  */
> +   switch (kind)
> +     {
> +     case vms_lib_alpha:
> +       if ((lhd.type != LBR__C_TYP_EOBJ && lhd.type != LBR__C_TYP_ESHSTB)
> +           || bfd_getl32 (lhd.majorid) != 3
> +           || lhd.nindex != 2)
> +         {
> +           bfd_set_error (bfd_error_wrong_format);
> +           return NULL;
> +         }
> +       break;
> +     case vms_lib_txt:
> +       if ((lhd.type != LBR__C_TYP_TXT
> +            && lhd.type != LBR__C_TYP_MLB
> +            && lhd.type != LBR__C_TYP_HLP)
> +           || bfd_getl32 (lhd.majorid) != 3
> +           || lhd.nindex != 1)
> +         {
> +           bfd_set_error (bfd_error_wrong_format);
> +           return NULL;
> +         }
> +       break;
> +     default:
> +       abort ();
> +     }
I didn't check the whole submission, so seeing this makes me wonder why 
text libraries seem to be allowed/supported, here. Later, I do see
> + /* Add a target for text library.  This costs almost nothing and is useful to
> +    read VMS library on the host.  */
but I'm not sure what will be read, here.

> + /* Build the symbols index.  */
> + 
> + static bfd_boolean
> + _bfd_vms_lib_build_map (unsigned int nbr_modules,
> +                         struct vms_index *modules,
> +                         unsigned int *res_cnt,
> +                         struct vms_index **res)
> + {
 From a quick look I don't see it, so: Do you reject (or plan to reject) 
the module if a symbol from the to be added module is already in the 
archive?

> +               if ((flags & BSF_GLOBAL
> +                    || flags & BSF_WEAK
> +                    || flags & BSF_INDIRECT
> +                    || bfd_is_com_section (sec))
> +                   && ! bfd_is_und_section (sec))

I may misinterpret the code, but VMS weak symbols and PSECT names are 
not in the global symbol table of a VMS object library.

Hartmut



More information about the Binutils mailing list