Article View: gnu.g++.bug
Article #1463ld.c patch
From: Gary Beihl
Date: Fri, 30 Sep 1988 20:48
Date: Fri, 30 Sep 1988 20:48
78 lines
2269 bytes
2269 bytes
Here's a patch to ld.c which returns a non-zero
exit status if multiply-defined symbols are found
or if undefined symbols are found when non-relocatable
output is desired.
*** ld.c.orig Fri Sep 30 15:04:36 1988
--- ld.c Fri Sep 30 15:09:15 1988
***************
*** 452,457 ****
--- 452,460 ----
/* Nonzero means should make the output file executable when done. */
/* Cleared by nonfatal errors. */
int make_executable;
+
+ /* Value to return upon termination */
+ int return_status;
/* C++: Take care of global constructors and destructors. */
void symtab_init_for_cplusplus ();
***************
*** 578,583 ****
--- 581,587 ----
T_flag_specified = 0;
magic = ZMAGIC;
make_executable = 1;
+ return_status = 0;
/* Initialize the cumulative counts of symbols. */
***************
*** 642,648 ****
if (cplusplus && unlink (ctor_and_dtor_filename))
perror_file (&file_table[number_of_files-1]);
! return 0;
}
void decode_option ();
--- 646,652 ----
if (cplusplus && unlink (ctor_and_dtor_filename))
perror_file (&file_table[number_of_files-1]);
! return return_status;
}
void decode_option ();
***************
*** 2154,2159 ****
--- 2158,2164 ----
if (defs++ && sp->value != p->n_value)
if (!erred++)
{
+ return_status = 1;
make_executable = 0;
error ("multiple definitions of symbol %s", sp->name);
}
***************
*** 2361,2368 ****
if (count)
fprintf (outfile, "\n");
! if (count)
make_executable = 0;
}
/* Write the output file */
--- 2366,2376 ----
if (count)
fprintf (outfile, "\n");
! if (count)
! {
make_executable = 0;
+ return_status = 1;
+ }
}
/* Write the output file */
Technical Details
Message-ID:
<8809302048.AA01140@sunspot>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!MCC.COM!beihl%cadillac.cad.mcc.comShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!MCC.COM!beihl%cadillac.cad.mcc.com From: beihl%cadillac.cad.mcc.com@MCC.COM (Gary Beihl) Newsgroups: gnu.g++.bug Subject: ld.c patch Message-ID: <8809302048.AA01140@sunspot> Date: 30 Sep 88 20:48:59 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 78