aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-10-29 00:21:36 +0000
committerSteve Chamberlain <sac@cygnus>1992-10-29 00:21:36 +0000
commit0b5995da247a6c5f52572e1f47de9a64dc187fba (patch)
tree0d780cfb9769834f4ef0a17e15483299ce24865c /ld
parentaff6e0b45a6aa18c1e377db3e7ed510c7b84f022 (diff)
downloadgdb-0b5995da247a6c5f52572e1f47de9a64dc187fba.zip
gdb-0b5995da247a6c5f52572e1f47de9a64dc187fba.tar.gz
gdb-0b5995da247a6c5f52572e1f47de9a64dc187fba.tar.bz2
* 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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ldsym.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ld/ldsym.c b/ld/ldsym.c
index 587c92e..d7c1340 100644
--- a/ld/ldsym.c
+++ b/ld/ldsym.c
@@ -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;