mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-14 00:40:55 +00:00
the correct fix for overzealous linking: preemptively turf unused externs
This commit is contained in:
parent
bb1b7c481c
commit
6a79ee57c4
1 changed files with 3 additions and 4 deletions
|
@ -269,6 +269,8 @@ process_def (qfo_def_t *def)
|
||||||
qfo_def_t *d;
|
qfo_def_t *d;
|
||||||
|
|
||||||
if (def->flags & QFOD_EXTERNAL) {
|
if (def->flags & QFOD_EXTERNAL) {
|
||||||
|
if (!def->num_relocs)
|
||||||
|
return;
|
||||||
if ((_d = Hash_Find (defined_defs, STRING (def->name)))) {
|
if ((_d = Hash_Find (defined_defs, STRING (def->name)))) {
|
||||||
def->ofs = deref_def (_d, &global_defs)->ofs;
|
def->ofs = deref_def (_d, &global_defs)->ofs;
|
||||||
def->flags = deref_def (_d, &global_defs)->flags;
|
def->flags = deref_def (_d, &global_defs)->flags;
|
||||||
|
@ -766,7 +768,6 @@ linker_add_lib (const char *libname)
|
||||||
qfo_def_t *def = qfo->defs + j;
|
qfo_def_t *def = qfo->defs + j;
|
||||||
if ((def->flags & QFOD_GLOBAL)
|
if ((def->flags & QFOD_GLOBAL)
|
||||||
&& !(def->flags & QFOD_EXTERNAL)
|
&& !(def->flags & QFOD_EXTERNAL)
|
||||||
&& def->relocs
|
|
||||||
&& Hash_Find (extern_defs, qfo->strings + def->name)) {
|
&& Hash_Find (extern_defs, qfo->strings + def->name)) {
|
||||||
if (options.verbosity >= 2)
|
if (options.verbosity >= 2)
|
||||||
printf ("adding %s because of %s\n",
|
printf ("adding %s because of %s\n",
|
||||||
|
@ -818,10 +819,8 @@ linker_finish (void)
|
||||||
undef_defs = (defref_t **) Hash_GetList (extern_defs);
|
undef_defs = (defref_t **) Hash_GetList (extern_defs);
|
||||||
for (defref = undef_defs; *defref; defref++) {
|
for (defref = undef_defs; *defref; defref++) {
|
||||||
qfo_def_t *def = deref_def (*defref, &global_defs);
|
qfo_def_t *def = deref_def (*defref, &global_defs);
|
||||||
if (def->num_relocs) {
|
|
||||||
def_error (def, "undefined symbol %s", STRING (def->name));
|
def_error (def, "undefined symbol %s", STRING (def->name));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
free (undef_defs);
|
free (undef_defs);
|
||||||
if (pr.error_count)
|
if (pr.error_count)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue