Fix core dump when plt_symbol didn't exist when needed with dynamic images.

This commit is contained in:
matt 1998-08-28 14:45:46 +00:00
parent 7c802b05c2
commit 81c6c6b8c6
3 changed files with 24 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ld.h,v 1.21 1998/08/26 14:37:41 matt Exp $ */
/* $NetBSD: ld.h,v 1.22 1998/08/28 14:45:46 matt Exp $ */
/*-
* This code is derived from software copyrighted by the Free Software
@ -56,6 +56,21 @@ extern int netzmagic;
#endif
#endif
#ifndef nounderscore
#define ETEXT_SYM "_etext"
#define EDATA_SYM "_edata"
#define END_SYM "_end"
#define DYN_SYM "__DYNAMIC"
#define GOT_SYM "__GLOBAL_OFFSET_TABLE_"
#define PLT_SYM "__PROCEDURE_LINKAGE_TABLE_"
#else
#define ETEXT_SYM "etext"
#define EDATA_SYM "edata"
#define END_SYM "end"
#define DYN_SYM "_DYNAMIC"
#define GOT_SYM "_GLOBAL_OFFSET_TABLE_"
#define PLT_SYM "_PROCEDURE_LINKAGE_TABLE_"
#endif
/*
* Ok. Following are the relocation information macros. If your

View File

@ -1,4 +1,4 @@
/* $NetBSD: rrs.c,v 1.21 1998/08/26 14:37:42 matt Exp $ */
/* $NetBSD: rrs.c,v 1.22 1998/08/28 14:45:46 matt Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@ -725,8 +725,13 @@ consider_rrs_section_lengths()
if (number_of_gotslots > 1)
got_symbol->flags |= GS_REFERENCED;
if (number_of_jmpslots > 1)
if (number_of_jmpslots > 1) {
if (plt_symbol == NULL) {
plt_symbol = getsym(PLT_SYM);
plt_symbol->defined = N_DATA | N_EXT;
}
plt_symbol->flags |= GS_REFERENCED;
}
/* Next, allocate relocs, got and plt */

View File

@ -1,4 +1,4 @@
/* $NetBSD: symbol.c,v 1.11 1998/08/27 21:20:44 matt Exp $ */
/* $NetBSD: symbol.c,v 1.12 1998/08/28 14:45:46 matt Exp $ */
/*
* - symbol table routines
@ -34,21 +34,6 @@ symtab_init(relocatable_output)
/*
* Put linker reserved symbols into symbol table.
*/
#ifndef nounderscore
#define ETEXT_SYM "_etext"
#define EDATA_SYM "_edata"
#define END_SYM "_end"
#define DYN_SYM "__DYNAMIC"
#define GOT_SYM "__GLOBAL_OFFSET_TABLE_"
#define PLT_SYM "__PROCEDURE_LINKAGE_TABLE_"
#else
#define ETEXT_SYM "etext"
#define EDATA_SYM "edata"
#define END_SYM "end"
#define DYN_SYM "_DYNAMIC"
#define GOT_SYM "_GLOBAL_OFFSET_TABLE_"
#define PLT_SYM "_PROCEDURE_LINKAGE_TABLE_"
#endif
dynamic_symbol = getsym(DYN_SYM);
dynamic_symbol->defined = relocatable_output?N_UNDF:(N_DATA | N_EXT);