* mri.c, ldlang.c, ldlex.l, ldgram.y: add new keywords

ALIGN, ALIGNMOD, and TRUNCATE.
	* ldsym.c: (hash_string, search, process_keepsyms): support
	truncation of symbols.
This commit is contained in:
Steve Chamberlain 1992-10-29 00:21:36 +00:00
parent aff6e0b45a
commit 0b5995da24
1 changed files with 7 additions and 6 deletions

View File

@ -57,7 +57,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ldmisc.h"
#include "ldlang.h"
/* IMPORT */
extern int symbol_truncate;
extern bfd *output_bfd;
extern strip_symbols_type strip_symbols;
extern discard_locals_type discard_locals;
@ -100,12 +100,13 @@ DEFUN(hash_string,(key),
{
register CONST char *cp;
register int k;
register int l = 0;
cp = key;
k = 0;
while (*cp)
while (*cp && l < symbol_truncate) {
k = (((k << 1) + (k >> 14)) ^ (*cp++)) & 0x3fff;
l++;
}
return k;
}
@ -120,7 +121,7 @@ DEFUN(search,(key,hashval) ,
{
ldsym_type *bp;
for (bp = global_symbol_hash_table[hashval]; bp; bp = bp->link)
if (! strcmp (key, bp->name)) {
if (! strncmp (key, bp->name, symbol_truncate)) {
if (bp->flags & SYM_INDIRECT) {
/* Use the symbol we're aliased to instead */
return (ldsym_type *)(bp->sdefs_chain);
@ -259,7 +260,7 @@ process_keepsyms (table, size)
*ptr-- = 0;
ptr = obstack_base (&obstack);
for (sym = out; sym < end; sym++)
if (!strcmp ((*sym)->name, ptr))
if (!strncmp ((*sym)->name, ptr, symbol_truncate))
{
KEEP (sym);
found = 1;