This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [VMS/committed] Make VMS library files extendable
On Mar 8, 2012, at 5:22 PM, h.becker wrote:
> Hi,
>
> The maximum length of symbols for ELF libraries is 1024, as it is defined in the LIBDEF header of the share:SYS$STARLET_C.TLB. On recent (8.n) VMS systems (Alpha and I64) you should see this:
>
> $ pipe libr/extr=lbrdef/out=sys$output sys$share:SYS$STARLET_C.TLB |search sys$pipe max,elf/matc=and
> #define LBR$C_ELFMAXKEYLEN 1024 /* Maximum length of an ASCII keyword for ELF libraries */
> $
Hi,
yes, there is something that I do not yet understand: Why did I set MAX_KEYLEN to 129 while the maximum key len on Alpha is 128 ?
Investigating…
Thank you for raising this issue!
Tristan.
>
> Hartmut
>
>
> On 03/08/12 15:25, Tristan Gingold wrote:
>> Hi,
>>
>> I recently noticed that VMS native ar tool (librarian) was not able to add members to an archive created by GNU ar.
>> This is because some fields of the headers were left to 0.
>> (This is not an issue to GNU ar, because contrary to VMS library, it always rewrite the whole archive).
>>
>> Also, the maximum length of symbols and filename were not correctly set for ia64-hp-openvms.
>>
>> Fixed by this patch.
>> Committed on trunk.
>>
>> Tristan.
>>
>> bfd/
>> 2012-03-08 Tristan Gingold<gingold@adacore.com>
>>
>> * vms-lib.c (_bfd_vms_lib_write_archive_contents): Set maximum
>> keylen according to archive kind. Set nextvbn and nextrfa lhd
>> fields. Add comments.
>>
>>
>> Index: vms-lib.c
>> ===================================================================
>> RCS file: /cvs/src/src/bfd/vms-lib.c,v
>> retrieving revision 1.19
>> diff -c -r1.19 vms-lib.c
>> *** vms-lib.c 23 Dec 2011 09:23:31 -0000 1.19
>> --- vms-lib.c 8 Mar 2012 14:15:05 -0000
>> ***************
>> *** 2006,2011 ****
>> --- 2006,2012 ----
>> unsigned int mod_idx_vbn;
>> unsigned int sym_idx_vbn;
>> bfd_boolean is_elfidx = tdata->kind == vms_lib_ia64;
>> + unsigned int max_keylen = is_elfidx ? 1025 : MAX_KEYLEN;
>>
>> /* Count the number of modules (and do a first sanity check). */
>> nbr_modules = 0;
>> ***************
>> *** 2037,2043 ****
>> current != NULL;
>> current = current->archive_next, i++)
>> {
>> ! int nl;
>>
>> modules[i].abfd = current;
>> modules[i].name = vms_get_module_name (current->filename, FALSE);
>> --- 2038,2044 ----
>> current != NULL;
>> current = current->archive_next, i++)
>> {
>> ! unsigned int nl;
>>
>> modules[i].abfd = current;
>> modules[i].name = vms_get_module_name (current->filename, FALSE);
>> ***************
>> *** 2045,2051 ****
>>
>> /* FIXME: silently truncate long names ? */
>> nl = strlen (modules[i].name);
>> ! modules[i].namlen = (nl> MAX_KEYLEN ? MAX_KEYLEN : nl);
>> }
>>
>> /* Create the module index. */
>> --- 2046,2052 ----
>>
>> /* FIXME: silently truncate long names ? */
>> nl = strlen (modules[i].name);
>> ! modules[i].namlen = (nl> max_keylen ? max_keylen : nl);
>> }
>>
>> /* Create the module index. */
>> ***************
>> *** 2236,2255 ****
>> bfd_putl32 (nbr_modules, lhd->modcnt);
>> bfd_putl32 (nbr_modules, lhd->modhdrs);
>>
>> bfd_putl32 (vbn - 1, lhd->hipreal);
>> bfd_putl32 (vbn - 1, lhd->hiprusd);
>>
>> /* First index (modules name). */
>> idd_flags = IDD__FLAGS_ASCII | IDD__FLAGS_VARLENIDX
>> | IDD__FLAGS_NOCASECMP | IDD__FLAGS_NOCASENTR;
>> bfd_putl16 (idd_flags, idd->flags);
>> ! bfd_putl16 (MAX_KEYLEN, idd->keylen);
>> bfd_putl16 (mod_idx_vbn, idd->vbn);
>> idd++;
>>
>> /* Second index (symbols name). */
>> bfd_putl16 (idd_flags, idd->flags);
>> ! bfd_putl16 (MAX_KEYLEN, idd->keylen);
>> bfd_putl16 (sym_idx_vbn, idd->vbn);
>> idd++;
>>
>> --- 2237,2263 ----
>> bfd_putl32 (nbr_modules, lhd->modcnt);
>> bfd_putl32 (nbr_modules, lhd->modhdrs);
>>
>> + /* Number of blocks for index. */
>> + bfd_putl32 (nbr_mod_iblk + nbr_sym_iblk, lhd->idxblks);
>> bfd_putl32 (vbn - 1, lhd->hipreal);
>> bfd_putl32 (vbn - 1, lhd->hiprusd);
>>
>> + /* VBN of the next free block. */
>> + bfd_putl32 ((off / VMS_BLOCK_SIZE) + 1, lhd->nextvbn);
>> + bfd_putl32 ((off / VMS_BLOCK_SIZE) + 1, lhd->nextrfa + 0);
>> + bfd_putl16 (0, lhd->nextrfa + 4);
>> +
>> /* First index (modules name). */
>> idd_flags = IDD__FLAGS_ASCII | IDD__FLAGS_VARLENIDX
>> | IDD__FLAGS_NOCASECMP | IDD__FLAGS_NOCASENTR;
>> bfd_putl16 (idd_flags, idd->flags);
>> ! bfd_putl16 (max_keylen, idd->keylen);
>> bfd_putl16 (mod_idx_vbn, idd->vbn);
>> idd++;
>>
>> /* Second index (symbols name). */
>> bfd_putl16 (idd_flags, idd->flags);
>> ! bfd_putl16 (max_keylen, idd->keylen);
>> bfd_putl16 (sym_idx_vbn, idd->vbn);
>> idd++;
>>
>>
>