diff options
-rwxr-xr-x | ld/Makefile | 3 | ||||
-rw-r--r-- | ld/ldlang.c | 70 |
2 files changed, 46 insertions, 27 deletions
diff --git a/ld/Makefile b/ld/Makefile index 014b17f..d5ef19f 100755 --- a/ld/Makefile +++ b/ld/Makefile @@ -32,7 +32,7 @@ MANSOURCES=ld.tex LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c \ ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c -GENERATED_SOURCES=ldgram.tab.c ldlex.c +GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h GENERATED_HEADERS=ldgram.tab.h LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l @@ -94,6 +94,7 @@ clean: - rm -f $(OBJS) $(GENERATED_SOURCES) $(GENERATED_HEADERS) - rm -f ld ld1 ld2 + lintlog:$(SOURCES) Makefile $(LINT) -abhxzn $(CFLAGS) $(LINTSOURCES) \ | grep -v "pointer casts may be troublesome" \ diff --git a/ld/ldlang.c b/ld/ldlang.c index 0df171f..d6bfe28 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -19,7 +19,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* $Id$ * * $Log$ - * Revision 1.2 1991/03/22 23:02:34 steve + * Revision 1.3 1991/03/27 00:52:49 steve + * *** empty log message *** + * + * Revision 1.2 1991/03/22 23:02:34 steve * Brought up to sync with Intel again. * * Revision 1.3 1991/03/16 22:19:21 rich @@ -2156,45 +2159,60 @@ char *memspec; current_section->region = lang_memory_region_lookup(memspec); stat_ptr = &statement_list; } +/* + Create an absolute symbol with the given name with the value of the + address of first byte of the section named. + If the symbol already exists, then do nothing. +*/ void lang_abs_symbol_at_beginning_of(section, name) char *section; char *name; { - extern bfd *output_bfd; - extern asymbol *create_symbol(); - asection *s = bfd_get_section_by_name(output_bfd, section); - asymbol *def = create_symbol(name, - BSF_GLOBAL | BSF_EXPORT | - BSF_ABSOLUTE, - (asection *)NULL); - if (s != (asection *)NULL) { - def->value = s->vma; - } - else { - def->value = 0; + if (ldsym_get_soft(name) == (asymbol *)NULL) { + extern bfd *output_bfd; + extern asymbol *create_symbol(); + asection *s = bfd_get_section_by_name(output_bfd, section); + asymbol *def = create_symbol(name, + BSF_GLOBAL | BSF_EXPORT | + BSF_ABSOLUTE, + (asection *)NULL); + if (s != (asection *)NULL) { + def->value = s->vma; + } + else { + def->value = 0; + } } } +/* + Create an absolute symbol with the given name with the value of the + address of the first byte after the end of the section named. + + If the symbol already exists, then do nothing. +*/ void lang_abs_symbol_at_end_of(section, name) char *section; char *name; { - extern bfd *output_bfd; - extern asymbol *create_symbol(); - asection *s = bfd_get_section_by_name(output_bfd, section); - /* Add a symbol called _end */ - asymbol *def = create_symbol(name, - BSF_GLOBAL | BSF_EXPORT | - BSF_ABSOLUTE, - (asection *)NULL); - if (s != (asection *)NULL) { - def->value = s->vma + s->size; - } - else { - def->value = 0; + if (ldsym_get_soft(name) == (asymbol *)NULL) { + extern bfd *output_bfd; + extern asymbol *create_symbol(); + asection *s = bfd_get_section_by_name(output_bfd, section); + /* Add a symbol called _end */ + asymbol *def = create_symbol(name, + BSF_GLOBAL | BSF_EXPORT | + BSF_ABSOLUTE, + (asection *)NULL); + if (s != (asection *)NULL) { + def->value = s->vma + s->size; + } + else { + def->value = 0; + } } } |