Fix a bug involving alias (N_INDR) symbols. When building a shared

library with a shared object dependency that contained alias symbols,
the linker incorrectly counted the number of symbols that would be
written, resulting in a fatal internal error.  Since our libc now
contains some alias symbols (in "net/res_stubs.c"), this was
sufficient to tickle the bug:  "ld -Bshareable foo.so -lc".  To
fix it, I moved the accounting of alias symbols to a later point
in the processing, where it is possible to count only those symbols
that will actually be written to the output file.

This fix is well-confined to affect alias symbols only.  I have
tested it with a full "make world".  I am going to merge it into
-2.2 after a few more days of living with it in -current.
This commit is contained in:
John Polstra 1997-02-01 20:28:38 +00:00
parent f552063e6c
commit 725f849afd
1 changed files with 8 additions and 2 deletions

View File

@ -1373,8 +1373,6 @@ enter_global_ref(lsp, name, entry)
lsp->nzlist.nz_type = N_TEXT|N_EXT;
lsp->nzlist.nz_value = 0;
make_executable = 0;
} else {
global_alias_count++;
}
#if 0
if (sp->flags & GS_REFERENCED)
@ -2382,6 +2380,14 @@ digest_pass2()
defined_global_sym_count++;
}
/*
* Count the aliases that will appear in the output.
*/
if (sp->alias && !sp->so_defined && !sp->alias->so_defined &&
(sp->defined || relocatable_output ||
!building_shared_object))
global_alias_count++;
if ((sp->defined & N_TYPE) == N_SETV) {
/*
* Set length word at front of vector and zero byte