Added -N and fixed -n flags.

Changed name of h8 support
This commit is contained in:
Steve Chamberlain 1991-10-05 00:36:45 +00:00
parent a18e791707
commit 3e4c643dc1
5 changed files with 152 additions and 126 deletions

View file

@ -29,6 +29,7 @@
#define GLD29K_EMULATION_NAME "gld29k" #define GLD29K_EMULATION_NAME "gld29k"
#define GLDNEWS_EMULATION_NAME "gldnews" #define GLDNEWS_EMULATION_NAME "gldnews"
#define LNK960_EMULATION_NAME "lnk960" #define LNK960_EMULATION_NAME "lnk960"
#define H8300HDS_EMULATION_NAME "h8300hds"
/* Otherwise default to this emulation */ /* Otherwise default to this emulation */
#ifndef DEFAULT_EMULATION #ifndef DEFAULT_EMULATION
#ifdef GNU960 #ifdef GNU960
@ -49,6 +50,8 @@
#define GLDM88KBCS_TARGET "m88kbcs" #define GLDM88KBCS_TARGET "m88kbcs"
#define GLD29K_TARGET "coff-a29k-big" #define GLD29K_TARGET "coff-a29k-big"
#define GLDNEWS_TARGET "a.out-newsos3" #define GLDNEWS_TARGET "a.out-newsos3"
#define H8300HDS_TARGET "ieee"

View file

@ -74,6 +74,14 @@ sparc)
;; ;;
m88k) my_target=m88k-bcs ;; m88k) my_target=m88k-bcs ;;
a29k) my_target=coff-a29k ;; a29k) my_target=coff-a29k ;;
h8300) my_target=h8300hds ;;
m68k)
case ${target_vendor} in
sun) my_target=sun3 ;;
sony) my_target=news;;
*) echo "Unknown 68k target vendor:" ${target_vendor} ;;
esac
esac esac
target_makefile_frag=config/t-${my_target} target_makefile_frag=config/t-${my_target}

View file

@ -16,6 +16,7 @@ SECTIONS
.data ALIGN(0x20000) : .data ALIGN(0x20000) :
{ {
*(.data) *(.data)
CONSTRUCTORS
_edata = .; _edata = .;
} }
.bss SIZEOF(.data) + ADDR(.data) : .bss SIZEOF(.data) + ADDR(.data) :

View file

@ -70,14 +70,12 @@ int multiple_def_count;
decremented when the common declaration is overridden decremented when the common declaration is overridden
Another way of thinking of it is that this is a count of Another way of thinking of it is that this is a count of
all ldsym_types with a ->scoms field all ldsym_types with a ->scoms field */
*/
unsigned int commons_pending; unsigned int commons_pending;
/* Count the number of global symbols referenced and not defined. /* Count the number of global symbols referenced and not defined.
common symbols are not included in this count. common symbols are not included in this count. */
*/
unsigned int undefined_global_sym_count; unsigned int undefined_global_sym_count;
@ -89,8 +87,6 @@ int warning_count;
/* have we had a load script ? */ /* have we had a load script ? */
extern boolean had_script; extern boolean had_script;
/* Nonzero means print names of input files as processed. */ /* Nonzero means print names of input files as processed. */
boolean trace_files; boolean trace_files;
@ -106,22 +102,13 @@ int unix_relocate;
enum target_flavour_enum output_flavor = BFD_BOUT_FORMAT; enum target_flavour_enum output_flavor = BFD_BOUT_FORMAT;
#endif #endif
/* Force the make_executable to be output, even if there are non-fatal /* Force the make_executable to be output, even if there are non-fatal
errors */ errors */
boolean force_make_executable; boolean force_make_executable;
/* A count of the total number of local symbols ever seen - by adding /* A count of the total number of local symbols ever seen - by adding
the symbol_count field of each newly read afile.*/ the symbol_count field of each newly read afile.*/
unsigned int total_symbols_seen; unsigned int total_symbols_seen;
/* A count of the number of read files - the same as the number of elements /* A count of the number of read files - the same as the number of elements
@ -129,7 +116,6 @@ unsigned int total_symbols_seen;
*/ */
unsigned int total_files_seen; unsigned int total_files_seen;
/* IMPORTS */ /* IMPORTS */
args_type command_line; args_type command_line;
ld_config_type config; ld_config_type config;
@ -142,6 +128,7 @@ main (argc, argv)
program_name = argv[0]; program_name = argv[0];
output_filename = "a.out"; output_filename = "a.out";
bfd_init();
#ifdef GNU960 #ifdef GNU960
{ {
int i; int i;
@ -163,8 +150,6 @@ main (argc, argv)
/* Initialize the data about options. */ /* Initialize the data about options. */
trace_files = false; trace_files = false;
write_map = false; write_map = false;
config.relocateable_output = false; config.relocateable_output = false;
unix_relocate = 0; unix_relocate = 0;
@ -188,12 +173,8 @@ main (argc, argv)
emulation= DEFAULT_EMULATION; emulation= DEFAULT_EMULATION;
} }
ldemul_choose_mode(emulation); ldemul_choose_mode(emulation);
default_target = ldemul_choose_target(); default_target = ldemul_choose_target();
lang_init(); lang_init();
ldemul_before_parse(); ldemul_before_parse();
lang_has_input_file = false; lang_has_input_file = false;
@ -207,12 +188,8 @@ main (argc, argv)
} }
ldemul_after_parse(); ldemul_after_parse();
lang_process(); lang_process();
/* Print error messages for any missing symbols, for any warning /* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions */ symbols, and possibly multiple definitions */
@ -223,6 +200,19 @@ main (argc, argv)
lang_map(stdout); lang_map(stdout);
} }
if (config.text_read_only) {
/* Look for a text section and mark the readonly attribute in it */
asection *found = bfd_get_section_by_name(output_bfd, ".text");
if (found == (asection *)NULL) {
info("%P%F: text marked read only, but no text section present");
}
found->flags |= SEC_READONLY;
output_bfd->flags |= WP_TEXT;
}
else {
output_bfd->flags |= WP_TEXT;
}
if (config.relocateable_output) { if (config.relocateable_output) {
output_bfd->flags &= ~( D_PAGED); output_bfd->flags &= ~( D_PAGED);
@ -253,7 +243,6 @@ Q_read_entry_symbols (desc, entry)
if (entry->asymbols == (asymbol **)NULL) { if (entry->asymbols == (asymbol **)NULL) {
bfd_size_type table_size = get_symtab_upper_bound(desc); bfd_size_type table_size = get_symtab_upper_bound(desc);
entry->asymbols = (asymbol **)ldmalloc(table_size); entry->asymbols = (asymbol **)ldmalloc(table_size);
entry->symbol_count = bfd_canonicalize_symtab(desc, entry->asymbols) ; entry->symbol_count = bfd_canonicalize_symtab(desc, entry->asymbols) ;
} }
} }
@ -312,26 +301,30 @@ Q_enter_global_ref (nlist_p)
ASSERT(sym->udata == 0); ASSERT(sym->udata == 0);
if (flag_is_constructor(this_symbol_flags)) { if (flag_is_constructor(this_symbol_flags)) {
/* Just remeber the name, do it once per name by placing it as if /* Add this constructor to the list we keep */
it were a zero sized common. The next ref */
ldlang_add_constructor(sp); ldlang_add_constructor(sp);
/* Turn any commons into refs */
if (sp->scoms_chain != (asymbol **)NULL) {
refize(sp, sp->scoms_chain);
sp->scoms_chain = 0;
}
} }
else { else {
if (flag_is_common(this_symbol_flags)) { if (flag_is_common(this_symbol_flags)) {
/* If we have a definition of this symbol already then /* If we have a definition of this symbol already then
* this common turns into a reference. Also we only this common turns into a reference. Also we only
* ever point to the largest common, so if we ever point to the largest common, so if we
* have a common, but it's bigger that the new symbol have a common, but it's bigger that the new symbol
* the turn this into a reference too. the turn this into a reference too. */
*/
if (sp->sdefs_chain) if (sp->sdefs_chain)
{ {
/* This is a common symbol, but we already have a definition /* This is a common symbol, but we already have a definition
for it, so just link it into the ref chain as if for it, so just link it into the ref chain as if
it were a reference it were a reference */
*/
refize(sp, nlist_p); refize(sp, nlist_p);
} }
else if (sp->scoms_chain) { else if (sp->scoms_chain) {
@ -347,9 +340,17 @@ Q_enter_global_ref (nlist_p)
} }
} }
else { else {
/* This is the first time we've seen a common, so /* This is the first time we've seen a common, so remember it
* remember it - if it was undefined before, we know it's defined now - if it was undefined before, we know it's defined now. If
the symbol has been marked as really being a constructor,
then treat this as a ref
*/ */
if (sp->flags & SYM_CONSTRUCTOR) {
/* Turn this into a ref */
refize(sp, nlist_p);
}
else {
/* treat like a common */
if (sp->srefs_chain) if (sp->srefs_chain)
undefined_global_sym_count--; undefined_global_sym_count--;
@ -357,6 +358,7 @@ Q_enter_global_ref (nlist_p)
sp->scoms_chain = nlist_p; sp->scoms_chain = nlist_p;
} }
} }
}
else if (flag_is_defined(this_symbol_flags)) { else if (flag_is_defined(this_symbol_flags)) {
/* This is the definition of a symbol, add to def chain */ /* This is the definition of a symbol, add to def chain */
@ -774,6 +776,12 @@ struct lang_input_statement_struct *entry;
/* If the symbol has an interesting definition, we could /* If the symbol has an interesting definition, we could
potentially want it. */ potentially want it. */
if (p->flags & BSF_INDIRECT) {
/* Grab out the name we've indirected to, and keep the insides
*/
add_indirect(q);
}
if (p->flags & BSF_FORT_COMM if (p->flags & BSF_FORT_COMM
|| p->flags & BSF_GLOBAL) || p->flags & BSF_GLOBAL)
{ {
@ -792,6 +800,10 @@ struct lang_input_statement_struct *entry;
if (flag_is_common(p->flags)) if (flag_is_common(p->flags))
{ {
/* If the symbol in the table is a constructor, we won't to
anything fancy with it */
if ((sp->flags & SYM_CONSTRUCTOR) == 0) {
/* This libary member has something to /* This libary member has something to
say about this element. We should say about this element. We should
remember if its a new size */ remember if its a new size */
@ -830,6 +842,7 @@ struct lang_input_statement_struct *entry;
bfd_make_section(com->the_bfd, "COMMON"); bfd_make_section(com->the_bfd, "COMMON");
} }
} }
}
ASSERT(p->udata == 0); ASSERT(p->udata == 0);
} }

View file

@ -137,7 +137,8 @@ static char *gld<target>_get_script()
config.build_constructors == true) { config.build_constructors == true) {
return gld<target>_script_option_Ur; return gld<target>_script_option_Ur;
} }
if (config.relocateable_output) { if (config.relocateable_output == true ||
config.magic_demand_paged == false) {
return gld<target>_script_option_r; return gld<target>_script_option_r;
} }