diff options
author | Tristan Gingold <gingold@adacore.com> | 2010-11-18 08:34:59 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2010-11-18 08:34:59 +0000 |
commit | b1b44664fba76d05bc4e1b20920215fbacdee5bd (patch) | |
tree | 7745716197b212a95a0759006a015e1878f14e0c | |
parent | d80cf1b39c0729f8c22c9adb9571d74c6fd391e7 (diff) | |
download | gdb-b1b44664fba76d05bc4e1b20920215fbacdee5bd.tar.gz |
Merge from trunk:
Changes by: gingold@sourceware.org 2010-11-17 11:32:53
Modified files:
bfd : ChangeLog vms-lib.c
Log message:
2010-11-17 Tristan Gingold <gingold@adacore.com>
* vms-lib.c (vms_write_index): Add comments.
Partially revert previous patch. Free blocks later.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/vms-lib.c | 40 |
2 files changed, 26 insertions, 19 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 194fdeb6e98..4ca660b20b8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2010-11-17 Tristan Gingold <gingold@adacore.com> + + * vms-lib.c (vms_write_index): Add comments. + Partially revert previous patch. Free blocks later. + 2010-11-10 Richard Sandiford <richard.sandiford@linaro.org> * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove unused diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c index 6ab78eab613..813ea39eddc 100644 --- a/bfd/vms-lib.c +++ b/bfd/vms-lib.c @@ -1551,6 +1551,7 @@ get_idxlen (struct lib_index *idx, bfd_boolean is_elfidx) /* Write the index. VBN is the first vbn to be used, and will contain on return the last vbn. + Can be called with ABFD set to NULL just to size the index. Return TRUE on success. */ static bfd_boolean @@ -1570,8 +1571,8 @@ vms_write_index (bfd *abfd, } blk[MAX_LEVEL]; /* The kbn blocks are used to store long symbol names. */ - unsigned int kbn_sz = 0; /* Number of bytes availble in the kbn block. */ - unsigned int kbn_vbn = 0; /* VBN of the kbn block. */ + unsigned int kbn_sz = 0; /* Number of bytes available in the kbn block. */ + unsigned int kbn_vbn = 0; /* VBN of the kbn block. */ unsigned char *kbn_blk = NULL; /* Contents of the kbn block. */ if (nbr == 0) @@ -1607,12 +1608,12 @@ vms_write_index (bfd *abfd, if (is_elfidx && idx->namlen >= MAX_KEYLEN) { - /* If the name is too long, write it in the kbn block. */ + /* If the key (ie name) is too long, write it in the kbn block. */ unsigned int kl = idx->namlen; unsigned int kl_chunk; const char *key = idx->name; - /* Write the name in the kbn, chunk after chunk. */ + /* Write the key in the kbn, chunk after chunk. */ do { if (kbn_sz < sizeof (struct vms_kbn)) @@ -1807,23 +1808,23 @@ vms_write_index (bfd *abfd, return TRUE; /* Flush. */ - for (j = level - 1; j >= 0; j--) + for (j = 1; j < level; j++) { - if (j > 0) - { - /* Update parent block: write the new entry. */ - unsigned char *en; - unsigned char *par; - struct vms_rfa *rfa; - - en = rblk[j - 1]->keys + blk[j - 1].len; - par = rblk[j]->keys + blk[j].len; - memcpy (par, en, blk[j - 1].lastlen); - rfa = (struct vms_rfa *)par; - bfd_putl32 (blk[j - 1].vbn, rfa->vbn); - bfd_putl16 (RFADEF__C_INDEX, rfa->offset); - } + /* Update parent block: write the new entry. */ + unsigned char *en; + unsigned char *par; + struct vms_rfa *rfa; + + en = rblk[j - 1]->keys + blk[j - 1].len; + par = rblk[j]->keys + blk[j].len; + memcpy (par, en, blk[j - 1].lastlen); + rfa = (struct vms_rfa *)par; + bfd_putl32 (blk[j - 1].vbn, rfa->vbn); + bfd_putl16 (RFADEF__C_INDEX, rfa->offset); + } + for (j = 0; j < level; j++) + { /* Write this block on the disk. */ bfd_putl16 (blk[j].len + blk[j].lastlen, rblk[j]->used); if (vms_write_block (abfd, blk[j].vbn, rblk[j]) != TRUE) @@ -1832,6 +1833,7 @@ vms_write_index (bfd *abfd, free (rblk[j]); } + /* Write the last kbn (if any). */ if (kbn_vbn != 0) { if (vms_write_block (abfd, kbn_vbn, kbn_blk) != TRUE) |