mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
0a1b45a20e
* sysdep.h: POISON_BFD_BOOLEAN: Define. * aix5ppc-core.c, * aout-cris.c, * aout-ns32k.c, * aout-target.h, * aoutx.h, * arc-got.h, * archive.c, * archive64.c, * archures.c, * bfd-in.h, * bfd.c, * bfdwin.c, * binary.c, * cache.c, * coff-alpha.c, * coff-arm.c, * coff-arm.h, * coff-bfd.c, * coff-bfd.h, * coff-go32.c, * coff-i386.c, * coff-ia64.c, * coff-mcore.c, * coff-mips.c, * coff-rs6000.c, * coff-sh.c, * coff-stgo32.c, * coff-tic30.c, * coff-tic4x.c, * coff-tic54x.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * corefile.c, * cpu-aarch64.c, * cpu-aarch64.h, * cpu-alpha.c, * cpu-arc.c, * cpu-arm.c, * cpu-arm.h, * cpu-avr.c, * cpu-bfin.c, * cpu-bpf.c, * cpu-cr16.c, * cpu-cris.c, * cpu-crx.c, * cpu-csky.c, * cpu-d10v.c, * cpu-d30v.c, * cpu-dlx.c, * cpu-epiphany.c, * cpu-fr30.c, * cpu-frv.c, * cpu-ft32.c, * cpu-h8300.c, * cpu-hppa.c, * cpu-i386.c, * cpu-ia64.c, * cpu-iamcu.c, * cpu-ip2k.c, * cpu-iq2000.c, * cpu-k1om.c, * cpu-l1om.c, * cpu-lm32.c, * cpu-m10200.c, * cpu-m10300.c, * cpu-m32c.c, * cpu-m32r.c, * cpu-m68hc11.c, * cpu-m68hc12.c, * cpu-m68k.c, * cpu-m9s12x.c, * cpu-m9s12xg.c, * cpu-mcore.c, * cpu-mep.c, * cpu-metag.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-mmix.c, * cpu-moxie.c, * cpu-msp430.c, * cpu-mt.c, * cpu-nds32.c, * cpu-nfp.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-pdp11.c, * cpu-pj.c, * cpu-powerpc.c, * cpu-pru.c, * cpu-riscv.c, * cpu-rl78.c, * cpu-rs6000.c, * cpu-rx.c, * cpu-s12z.c, * cpu-s390.c, * cpu-score.c, * cpu-sh.c, * cpu-sparc.c, * cpu-spu.c, * cpu-tic30.c, * cpu-tic4x.c, * cpu-tic54x.c, * cpu-tic6x.c, * cpu-tilegx.c, * cpu-tilepro.c, * cpu-v850.c, * cpu-v850_rh850.c, * cpu-vax.c, * cpu-visium.c, * cpu-wasm32.c, * cpu-xc16x.c, * cpu-xgate.c, * cpu-xstormy16.c, * cpu-xtensa.c, * cpu-z80.c, * cpu-z8k.c, * dwarf1.c, * dwarf2.c, * ecoff-bfd.h, * ecoff.c, * ecofflink.c, * elf-attrs.c, * elf-bfd.h, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-nacl.c, * elf-nacl.h, * elf-properties.c, * elf-s390-common.c, * elf-s390.h, * elf-strtab.c, * elf-vxworks.c, * elf-vxworks.h, * elf.c, * elf32-am33lin.c, * elf32-arc.c, * elf32-arm.c, * elf32-arm.h, * elf32-avr.c, * elf32-avr.h, * elf32-bfin.c, * elf32-bfin.h, * elf32-cr16.c, * elf32-cr16.h, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-csky.h, * elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-gen.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-hppa.h, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c, * elf32-m68hc1x.h, * elf32-m68k.c, * elf32-m68k.h, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-metag.h, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-nios2.h, * elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s12z.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h, * elf32-score7.c, * elf32-sh-relocs.h, * elf32-sh.c, * elf32-sparc.c, * elf32-spu.c, * elf32-spu.h, * elf32-tic6x.c, * elf32-tic6x.h, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-v850.h, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf32-z80.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-gen.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-nfp.c, * elf64-ppc.c, * elf64-ppc.h, * elf64-s390.c, * elf64-sparc.c, * elf64-tilegx.c, * elf64-x86-64.c, * elfcode.h, * elfcore.h, * elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c, * elfxx-ia64.h, * elfxx-mips.c, * elfxx-mips.h, * elfxx-riscv.c, * elfxx-riscv.h, * elfxx-sparc.c, * elfxx-sparc.h, * elfxx-target.h, * elfxx-tilegx.c, * elfxx-tilegx.h, * elfxx-x86.c, * elfxx-x86.h, * format.c, * genlink.h, * hash.c, * i386aout.c, * i386lynx.c, * i386msdos.c, * ihex.c, * libaout.h, * libbfd-in.h, * libbfd.c, * libcoff-in.h, * libecoff.h, * libpei.h, * libxcoff.h, * linker.c, * mach-o-aarch64.c, * mach-o-arm.c, * mach-o-i386.c, * mach-o-x86-64.c, * mach-o.c, * mach-o.h, * merge.c, * mmo.c, * netbsd.h, * opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-sh.c, * pe-x86_64.c, * peXXigen.c, * pef.c, * pei-arm.c, * pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-sh.c, * pei-x86_64.c, * peicode.h, * plugin.c, * plugin.h, * ppcboot.c, * reloc.c, * reloc16.c, * rs6000-core.c, * section.c, * simple.c, * som.c, * som.h, * srec.c, * stabs.c, * syms.c, * targets.c, * tekhex.c, * verilog.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c, * vms.h, * wasm-module.c, * xcofflink.c, * xcofflink.h, * xsym.c, * xsym.h: Replace bfd_boolean with bool, FALSE with false, and TRUE with true throughout. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
472 lines
11 KiB
C
472 lines
11 KiB
C
/* ELF strtab with GC and suffix merging support.
|
|
Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
|
Written by Jakub Jelinek <jakub@redhat.com>.
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
MA 02110-1301, USA. */
|
|
|
|
#include "sysdep.h"
|
|
#include "bfd.h"
|
|
#include "libbfd.h"
|
|
#include "elf-bfd.h"
|
|
#include "hashtab.h"
|
|
#include "libiberty.h"
|
|
|
|
/* An entry in the strtab hash table. */
|
|
|
|
struct elf_strtab_hash_entry
|
|
{
|
|
struct bfd_hash_entry root;
|
|
/* Length of this entry. This includes the zero terminator. */
|
|
int len;
|
|
unsigned int refcount;
|
|
union {
|
|
/* Index within the merged section. */
|
|
bfd_size_type index;
|
|
/* Entry this is a suffix of (if len < 0). */
|
|
struct elf_strtab_hash_entry *suffix;
|
|
} u;
|
|
};
|
|
|
|
/* The strtab hash table. */
|
|
|
|
struct elf_strtab_hash
|
|
{
|
|
struct bfd_hash_table table;
|
|
/* Next available index. */
|
|
size_t size;
|
|
/* Number of array entries alloced. */
|
|
size_t alloced;
|
|
/* Final strtab size. */
|
|
bfd_size_type sec_size;
|
|
/* Array of pointers to strtab entries. */
|
|
struct elf_strtab_hash_entry **array;
|
|
};
|
|
|
|
/* Routine to create an entry in a section merge hashtab. */
|
|
|
|
static struct bfd_hash_entry *
|
|
elf_strtab_hash_newfunc (struct bfd_hash_entry *entry,
|
|
struct bfd_hash_table *table,
|
|
const char *string)
|
|
{
|
|
/* Allocate the structure if it has not already been allocated by a
|
|
subclass. */
|
|
if (entry == NULL)
|
|
entry = (struct bfd_hash_entry *)
|
|
bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
|
|
if (entry == NULL)
|
|
return NULL;
|
|
|
|
/* Call the allocation method of the superclass. */
|
|
entry = bfd_hash_newfunc (entry, table, string);
|
|
|
|
if (entry)
|
|
{
|
|
/* Initialize the local fields. */
|
|
struct elf_strtab_hash_entry *ret;
|
|
|
|
ret = (struct elf_strtab_hash_entry *) entry;
|
|
ret->u.index = -1;
|
|
ret->refcount = 0;
|
|
ret->len = 0;
|
|
}
|
|
|
|
return entry;
|
|
}
|
|
|
|
/* Create a new hash table. */
|
|
|
|
struct elf_strtab_hash *
|
|
_bfd_elf_strtab_init (void)
|
|
{
|
|
struct elf_strtab_hash *table;
|
|
size_t amt = sizeof (struct elf_strtab_hash);
|
|
|
|
table = (struct elf_strtab_hash *) bfd_malloc (amt);
|
|
if (table == NULL)
|
|
return NULL;
|
|
|
|
if (!bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc,
|
|
sizeof (struct elf_strtab_hash_entry)))
|
|
{
|
|
free (table);
|
|
return NULL;
|
|
}
|
|
|
|
table->sec_size = 0;
|
|
table->size = 1;
|
|
table->alloced = 64;
|
|
amt = sizeof (struct elf_strtab_hasn_entry *);
|
|
table->array = ((struct elf_strtab_hash_entry **)
|
|
bfd_malloc (table->alloced * amt));
|
|
if (table->array == NULL)
|
|
{
|
|
free (table);
|
|
return NULL;
|
|
}
|
|
|
|
table->array[0] = NULL;
|
|
|
|
return table;
|
|
}
|
|
|
|
/* Free a strtab. */
|
|
|
|
void
|
|
_bfd_elf_strtab_free (struct elf_strtab_hash *tab)
|
|
{
|
|
bfd_hash_table_free (&tab->table);
|
|
free (tab->array);
|
|
free (tab);
|
|
}
|
|
|
|
/* Get the index of an entity in a hash table, adding it if it is not
|
|
already present. */
|
|
|
|
size_t
|
|
_bfd_elf_strtab_add (struct elf_strtab_hash *tab,
|
|
const char *str,
|
|
bool copy)
|
|
{
|
|
register struct elf_strtab_hash_entry *entry;
|
|
|
|
/* We handle this specially, since we don't want to do refcounting
|
|
on it. */
|
|
if (*str == '\0')
|
|
return 0;
|
|
|
|
BFD_ASSERT (tab->sec_size == 0);
|
|
entry = (struct elf_strtab_hash_entry *)
|
|
bfd_hash_lookup (&tab->table, str, true, copy);
|
|
|
|
if (entry == NULL)
|
|
return (size_t) -1;
|
|
|
|
entry->refcount++;
|
|
if (entry->len == 0)
|
|
{
|
|
entry->len = strlen (str) + 1;
|
|
/* 2G strings lose. */
|
|
BFD_ASSERT (entry->len > 0);
|
|
if (tab->size == tab->alloced)
|
|
{
|
|
bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
|
|
tab->alloced *= 2;
|
|
tab->array = (struct elf_strtab_hash_entry **)
|
|
bfd_realloc_or_free (tab->array, tab->alloced * amt);
|
|
if (tab->array == NULL)
|
|
return (size_t) -1;
|
|
}
|
|
|
|
entry->u.index = tab->size++;
|
|
tab->array[entry->u.index] = entry;
|
|
}
|
|
return entry->u.index;
|
|
}
|
|
|
|
void
|
|
_bfd_elf_strtab_addref (struct elf_strtab_hash *tab, size_t idx)
|
|
{
|
|
if (idx == 0 || idx == (size_t) -1)
|
|
return;
|
|
BFD_ASSERT (tab->sec_size == 0);
|
|
BFD_ASSERT (idx < tab->size);
|
|
++tab->array[idx]->refcount;
|
|
}
|
|
|
|
void
|
|
_bfd_elf_strtab_delref (struct elf_strtab_hash *tab, size_t idx)
|
|
{
|
|
if (idx == 0 || idx == (size_t) -1)
|
|
return;
|
|
BFD_ASSERT (tab->sec_size == 0);
|
|
BFD_ASSERT (idx < tab->size);
|
|
BFD_ASSERT (tab->array[idx]->refcount > 0);
|
|
--tab->array[idx]->refcount;
|
|
}
|
|
|
|
unsigned int
|
|
_bfd_elf_strtab_refcount (struct elf_strtab_hash *tab, size_t idx)
|
|
{
|
|
return tab->array[idx]->refcount;
|
|
}
|
|
|
|
void
|
|
_bfd_elf_strtab_clear_all_refs (struct elf_strtab_hash *tab)
|
|
{
|
|
size_t idx;
|
|
|
|
for (idx = 1; idx < tab->size; idx++)
|
|
tab->array[idx]->refcount = 0;
|
|
}
|
|
|
|
/* Save strtab refcounts prior to adding --as-needed library. */
|
|
|
|
struct strtab_save
|
|
{
|
|
size_t size;
|
|
unsigned int refcount[1];
|
|
};
|
|
|
|
void *
|
|
_bfd_elf_strtab_save (struct elf_strtab_hash *tab)
|
|
{
|
|
struct strtab_save *save;
|
|
size_t idx, size;
|
|
|
|
size = sizeof (*save) + (tab->size - 1) * sizeof (save->refcount[0]);
|
|
save = bfd_malloc (size);
|
|
if (save == NULL)
|
|
return save;
|
|
|
|
save->size = tab->size;
|
|
for (idx = 1; idx < tab->size; idx++)
|
|
save->refcount[idx] = tab->array[idx]->refcount;
|
|
return save;
|
|
}
|
|
|
|
/* Restore strtab refcounts on finding --as-needed library not needed. */
|
|
|
|
void
|
|
_bfd_elf_strtab_restore (struct elf_strtab_hash *tab, void *buf)
|
|
{
|
|
size_t idx, curr_size = tab->size, save_size;
|
|
struct strtab_save *save = (struct strtab_save *) buf;
|
|
|
|
BFD_ASSERT (tab->sec_size == 0);
|
|
save_size = 1;
|
|
if (save != NULL)
|
|
save_size = save->size;
|
|
BFD_ASSERT (save_size <= curr_size);
|
|
tab->size = save_size;
|
|
for (idx = 1; idx < save_size; ++idx)
|
|
tab->array[idx]->refcount = save->refcount[idx];
|
|
|
|
for (; idx < curr_size; ++idx)
|
|
{
|
|
/* We don't remove entries from the hash table, just set their
|
|
REFCOUNT to zero. Setting LEN zero will result in the size
|
|
growing if the entry is added again. See _bfd_elf_strtab_add. */
|
|
tab->array[idx]->refcount = 0;
|
|
tab->array[idx]->len = 0;
|
|
}
|
|
}
|
|
|
|
bfd_size_type
|
|
_bfd_elf_strtab_size (struct elf_strtab_hash *tab)
|
|
{
|
|
return tab->sec_size ? tab->sec_size : tab->size;
|
|
}
|
|
|
|
bfd_size_type
|
|
_bfd_elf_strtab_len (struct elf_strtab_hash *tab)
|
|
{
|
|
return tab->size;
|
|
}
|
|
|
|
bfd_size_type
|
|
_bfd_elf_strtab_offset (struct elf_strtab_hash *tab, size_t idx)
|
|
{
|
|
struct elf_strtab_hash_entry *entry;
|
|
|
|
if (idx == 0)
|
|
return 0;
|
|
BFD_ASSERT (idx < tab->size);
|
|
BFD_ASSERT (tab->sec_size);
|
|
entry = tab->array[idx];
|
|
BFD_ASSERT (entry->refcount > 0);
|
|
entry->refcount--;
|
|
return tab->array[idx]->u.index;
|
|
}
|
|
|
|
const char *
|
|
_bfd_elf_strtab_str (struct elf_strtab_hash *tab, size_t idx,
|
|
bfd_size_type *offset)
|
|
{
|
|
if (idx == 0)
|
|
return NULL;
|
|
BFD_ASSERT (idx < tab->size);
|
|
BFD_ASSERT (tab->sec_size);
|
|
if (tab->array[idx]->refcount == 0)
|
|
return NULL;
|
|
if (offset)
|
|
*offset = tab->array[idx]->u.index;
|
|
return tab->array[idx]->root.string;
|
|
}
|
|
|
|
bool
|
|
_bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
|
|
{
|
|
bfd_size_type off = 1;
|
|
size_t i;
|
|
|
|
if (bfd_bwrite ("", 1, abfd) != 1)
|
|
return false;
|
|
|
|
for (i = 1; i < tab->size; ++i)
|
|
{
|
|
register const char *str;
|
|
register unsigned int len;
|
|
|
|
BFD_ASSERT (tab->array[i]->refcount == 0);
|
|
len = tab->array[i]->len;
|
|
if ((int) len < 0)
|
|
continue;
|
|
|
|
str = tab->array[i]->root.string;
|
|
if (bfd_bwrite (str, len, abfd) != len)
|
|
return false;
|
|
|
|
off += len;
|
|
}
|
|
|
|
BFD_ASSERT (off == tab->sec_size);
|
|
return true;
|
|
}
|
|
|
|
/* Compare two elf_strtab_hash_entry structures. Called via qsort.
|
|
Won't ever return zero as all entries differ, so there is no issue
|
|
with qsort stability here. */
|
|
|
|
static int
|
|
strrevcmp (const void *a, const void *b)
|
|
{
|
|
struct elf_strtab_hash_entry *A = *(struct elf_strtab_hash_entry **) a;
|
|
struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b;
|
|
unsigned int lenA = A->len;
|
|
unsigned int lenB = B->len;
|
|
const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
|
|
const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
|
|
int l = lenA < lenB ? lenA : lenB;
|
|
|
|
while (l)
|
|
{
|
|
if (*s != *t)
|
|
return (int) *s - (int) *t;
|
|
s--;
|
|
t--;
|
|
l--;
|
|
}
|
|
return lenA - lenB;
|
|
}
|
|
|
|
static inline int
|
|
is_suffix (const struct elf_strtab_hash_entry *A,
|
|
const struct elf_strtab_hash_entry *B)
|
|
{
|
|
if (A->len <= B->len)
|
|
/* B cannot be a suffix of A unless A is equal to B, which is guaranteed
|
|
not to be equal by the hash table. */
|
|
return 0;
|
|
|
|
return memcmp (A->root.string + (A->len - B->len),
|
|
B->root.string, B->len - 1) == 0;
|
|
}
|
|
|
|
/* This function assigns final string table offsets for used strings,
|
|
merging strings matching suffixes of longer strings if possible. */
|
|
|
|
void
|
|
_bfd_elf_strtab_finalize (struct elf_strtab_hash *tab)
|
|
{
|
|
struct elf_strtab_hash_entry **array, **a, *e;
|
|
bfd_size_type amt, sec_size;
|
|
size_t size, i;
|
|
|
|
/* Sort the strings by suffix and length. */
|
|
amt = tab->size;
|
|
amt *= sizeof (struct elf_strtab_hash_entry *);
|
|
array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
|
|
if (array == NULL)
|
|
goto alloc_failure;
|
|
|
|
for (i = 1, a = array; i < tab->size; ++i)
|
|
{
|
|
e = tab->array[i];
|
|
if (e->refcount)
|
|
{
|
|
*a++ = e;
|
|
/* Adjust the length to not include the zero terminator. */
|
|
e->len -= 1;
|
|
}
|
|
else
|
|
e->len = 0;
|
|
}
|
|
|
|
size = a - array;
|
|
if (size != 0)
|
|
{
|
|
qsort (array, size, sizeof (struct elf_strtab_hash_entry *), strrevcmp);
|
|
|
|
/* Loop over the sorted array and merge suffixes. Start from the
|
|
end because we want eg.
|
|
|
|
s1 -> "d"
|
|
s2 -> "bcd"
|
|
s3 -> "abcd"
|
|
|
|
to end up as
|
|
|
|
s3 -> "abcd"
|
|
s2 _____^
|
|
s1 _______^
|
|
|
|
ie. we don't want s1 pointing into the old s2. */
|
|
e = *--a;
|
|
e->len += 1;
|
|
while (--a >= array)
|
|
{
|
|
struct elf_strtab_hash_entry *cmp = *a;
|
|
|
|
cmp->len += 1;
|
|
if (is_suffix (e, cmp))
|
|
{
|
|
cmp->u.suffix = e;
|
|
cmp->len = -cmp->len;
|
|
}
|
|
else
|
|
e = cmp;
|
|
}
|
|
}
|
|
|
|
alloc_failure:
|
|
free (array);
|
|
|
|
/* Assign positions to the strings we want to keep. */
|
|
sec_size = 1;
|
|
for (i = 1; i < tab->size; ++i)
|
|
{
|
|
e = tab->array[i];
|
|
if (e->refcount && e->len > 0)
|
|
{
|
|
e->u.index = sec_size;
|
|
sec_size += e->len;
|
|
}
|
|
}
|
|
|
|
tab->sec_size = sec_size;
|
|
|
|
/* Adjust the rest. */
|
|
for (i = 1; i < tab->size; ++i)
|
|
{
|
|
e = tab->array[i];
|
|
if (e->refcount && e->len < 0)
|
|
e->u.index = e->u.suffix->u.index + (e->u.suffix->len + e->len);
|
|
}
|
|
}
|