--- /dev/null
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+
+This file is part of GLD, the Gnu Linker.
+
+GLD is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+GLD is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GLD; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/*
+ * $Id$
+ */
+
+/*
+ * clearing house for ld emulation states
+ */
+
+#include "bfd.h"
+#include "sysdep.h"
+
+#include "config.h"
+#include "ld.h"
+#include "ldemul.h"
+#include "ldmisc.h"
+
+extern ld_emulation_xfer_type ld_lnk960_emulation;
+extern ld_emulation_xfer_type ld_gldm88kbcs_emulation;
+extern ld_emulation_xfer_type ld_gld_emulation;
+extern ld_emulation_xfer_type ld_vanilla_emulation;
+extern ld_emulation_xfer_type ld_gld68k_emulation;
+extern ld_emulation_xfer_type ld_gld960_emulation;
+extern ld_emulation_xfer_type ld_gld29k_emulation;
+extern ld_emulation_xfer_type ld_gldnews_emulation;
+extern ld_emulation_xfer_type ld_h8300hds_emulation;
+
+
+ld_emulation_xfer_type *ld_emulation;
+
+void
+ldemul_hll(name)
+char *name;
+{
+ ld_emulation->hll(name);
+}
+
+
+void ldemul_syslib(name)
+char *name;
+{
+ ld_emulation->syslib(name);
+}
+
+void
+ldemul_after_parse()
+{
+ ld_emulation->after_parse();
+}
+
+void
+ldemul_before_parse()
+{
+ ld_emulation->before_parse();
+}
+
+void
+ldemul_after_allocation()
+{
+ ld_emulation->after_allocation();
+}
+
+void
+ldemul_before_allocation()
+{
+ if (ld_emulation->before_allocation) {
+ ld_emulation->before_allocation();
+ }
+}
+
+
+void
+ldemul_set_output_arch()
+{
+ ld_emulation->set_output_arch();
+}
+
+char *
+ldemul_choose_target()
+{
+ return ld_emulation->choose_target();
+}
+
+char *
+ldemul_get_script()
+{
+ return ld_emulation->get_script();
+}
+
+void
+ldemul_choose_mode(target)
+char *target;
+{
+ if (strcmp(target,LNK960_EMULATION_NAME)==0) {
+ ld_emulation = &ld_lnk960_emulation;
+ }
+ else if (strcmp(target,GLD960_EMULATION_NAME)==0) {
+ ld_emulation = &ld_gld960_emulation;
+ }
+ else if (strcmp(target,GLDM88KBCS_EMULATION_NAME)==0) {
+ ld_emulation = &ld_gldm88kbcs_emulation;
+ }
+#ifndef GNU960
+ else if (strcmp(target,GLD_EMULATION_NAME)==0) {
+ ld_emulation = &ld_gld_emulation;
+ }
+ else if (strcmp(target,VANILLA_EMULATION_NAME)==0) {
+ ld_emulation = &ld_vanilla_emulation;
+ }
+ else if (strcmp(target,H8300HDS_EMULATION_NAME)==0) {
+ ld_emulation = &ld_h8300hds_emulation;
+ }
+
+ else if (strcmp(target,GLD68K_EMULATION_NAME)==0) {
+ ld_emulation = &ld_gld68k_emulation;
+ }
+ else if (strcmp(target,GLD29K_EMULATION_NAME)==0) {
+ ld_emulation = &ld_gld29k_emulation;
+ }
+ else if (strcmp(target,GLDNEWS_EMULATION_NAME)==0) {
+ ld_emulation = &ld_gldnews_emulation;
+ }
+#endif
+ else {
+ info("%P%F unrecognised emulation mode: %s\n",target);
+ }
+}
+
+
+
*/
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ld.h"
*/
+#define DONTDECLARE_MALLOC
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ld.h"
#include "ldexp.h"
#include "ldver.h"
#include "ldlang.h"
-#include "ld-emul.h"
+#include "ldemul.h"
#include "ldfile.h"
#include "ldmisc.h"
+
+
#define YYDEBUG 1
boolean option_v;
#ifdef __STDC__
void lang_add_data(int type, union etree_union *exp);
-void lang_enter_output_section_statement(char *output_section_statement_name, etree_type *address_exp, bfd_vma block_value);
+void lang_enter_output_section_statement(char *output_section_statement_name, etree_type *address_exp, int flags, bfd_vma block_value);
#else
}
%type <etree> exp opt_exp
-%type <integer> fill_opt opt_block
+%type <integer> fill_opt opt_block opt_type
%type <name> memspec_opt
%token <integer> INT
%token <name> NAME
%token '{' '}'
%token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
%token SIZEOF_HEADERS
-%token MEMORY
+%token MEMORY
+%token NOLOAD DSECT COPY INFO OVERLAY
%token NAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY
%token OPTION_e OPTION_c OPTION_noinhibit_exec OPTION_s OPTION_S OPTION_sort_common
-%token OPTION_format OPTION_F OPTION_u
+%token OPTION_format OPTION_F OPTION_u OPTION_Bstatic OPTION_N
%token <integer> SIZEOF NEXT ADDR
%token OPTION_d OPTION_dc OPTION_dp OPTION_x OPTION_X OPTION_defsym
%token OPTION_v OPTION_M OPTION_t STARTUP HLL SYSLIB FLOAT NOFLOAT
%token <name> OPTION_l OPTION_L OPTION_T OPTION_Aarch OPTION_Tfile OPTION_Texp
%token OPTION_Ur
%token ORIGIN FILL OPTION_g
-%token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT
+%token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS
%type <token> assign_op
%type <name> filename
ifile_list
{ ldgram_in_script = false; }
'}'
+ | OPTION_Bstatic { }
| OPTION_v
{
ldversion();
}
| OPTION_n {
config.magic_demand_paged = false;
- config.make_executable = false;
+ config.text_read_only = true;
}
+ | OPTION_N {
+ config.magic_demand_paged = false;
+ }
| OPTION_s {
strip_symbols = STRIP_ALL;
}
| NAME
{ lang_add_input_file($1,lang_input_file_is_file_enum,
(char *)NULL); }
- | OPTION_c filename script_file
- { ldfile_open_command_file($2); }
+ | OPTION_c filename
+ { ldfile_open_command_file($2); } script_file
| OPTION_Tfile
{ ldfile_open_command_file($1); } script_file
| low_level_library
| floating_point_support
| statement_anywhere
+ | ';'
| TARGET_K '(' NAME ')'
{ lang_add_target($3); }
| SEARCH_DIR '(' filename ')'
| statement CREATE_OBJECT_SYMBOLS
{
lang_add_attribute(lang_object_symbols_statement_enum); }
+ | statement ';'
+ | statement CONSTRUCTORS
+ {
+ lang_add_attribute(lang_constructors_statement_enum); }
| statement input_section_spec
| statement length '(' exp ')'
{ $$ = exp_nameop(SIZEOF_HEADERS,0); }
| SIZEOF '(' NAME ')'
- { $$ = exp_nameop($1,$3); }
+ { $$ = exp_nameop(SIZEOF,$3); }
| ADDR '(' NAME ')'
- { $$ = exp_nameop($1,$3); }
+ { $$ = exp_nameop(ADDR,$3); }
| ALIGN_K '(' exp ')'
- { $$ = exp_unop($1,$3); }
+ { $$ = exp_unop(ALIGN_K,$3); }
| NAME
{ $$ = exp_nameop(NAME,$1); }
;
-section: NAME opt_exp opt_block ':' opt_things'{'
+section: NAME opt_exp opt_type opt_block ':' opt_things'{'
{
- lang_enter_output_section_statement($1,$2,$3);
+ lang_enter_output_section_statement($1,$2,$3,$4);
}
statement '}' fill_opt memspec_opt
{
- lang_leave_output_section_statement($10, $11);
+ lang_leave_output_section_statement($11, $12);
}
;
+opt_type:
+ '(' NOLOAD ')' { $$ = SEC_NO_FLAGS; }
+ | '(' DSECT ')' { $$ = 0; }
+ | '(' COPY ')' { $$ = 0; }
+ | '(' INFO ')' { $$ = 0; }
+ | '(' OVERLAY ')' { $$ = 0; }
+ | { $$ = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; }
+ ;
+
opt_things:
{
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ld.h"
#include "ldsym.h"
#include "ldmisc.h"
*
*/
-
-
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ld.h"
#include "ldmain.h"
Add the supplied name to the symbol table as an undefined reference.
Remove items from the chain as we open input bfds
*/
-typedef struct ldlang_undef_chain_list_struct {
- struct ldlang_undef_chain_list_struct *next;
+typedef struct ldlang_undef_chain_list {
+ struct ldlang_undef_chain_list *next;
char *name;
} ldlang_undef_chain_list_type;
{
produce_warnings(lgs, it);
}
- if (lgs->flags & SYM_INDIRECT)
- {
- do_indirect(lgs);
- }
while (ptr != (asymbol **)NULL) {
asymbol *ref = *ptr;
bfd * input_bfd;
unsigned long input_machine;
enum bfd_architecture input_architecture;
-CONST char *out_arch;
- char *out_arch2;
+ CONST bfd_arch_info_type *compatible;
for (file = file_chain.head;
file != (lang_statement_union_type *)NULL;
input_bfd = file->input_statement.the_bfd;
- input_machine = bfd_get_machine(input_bfd);
- input_architecture = bfd_get_architecture(input_bfd);
+ input_machine = bfd_get_mach(input_bfd);
+ input_architecture = bfd_get_arch(input_bfd);
- /* Inspect the architecture and ensure we're linking like with like */
- if (!bfd_arch_compatible(input_bfd,
- output_bfd,
- &ldfile_new_output_architecture,
- &ldfile_new_output_machine))
- {
+ /* Inspect the architecture and ensure we're linking like with
+ like */
- /* Result of bfd_printable_arch_mach is not guaranteed to stick
- around after next call, so we have to copy it. */
- out_arch = bfd_printable_arch_mach(ldfile_output_architecture,
- ldfile_output_machine);
- out_arch2 = ldmalloc (strlen (out_arch)+1);
- strcpy (out_arch2, out_arch);
+ compatible=bfd_arch_get_compatible(input_bfd,
+ output_bfd);
- info("%P: warning, %s architecture of input file `%B' incompatible with %s output\n",
- bfd_printable_arch_mach(input_architecture, input_machine),
- input_bfd,
- out_arch2);
- free (out_arch2);
+ if (compatible)
+ {
+ ldfile_output_machine = compatible->mach;
+ ldfile_output_architecture = compatible->arch;
+ }
+ else
+ {
+ info("%P: warning, %s architecture of input file `%B' incompatible with %s output\n",
+ bfd_printable_name(input_bfd), input_bfd,
+ bfd_printable_name(output_bfd));
bfd_set_arch_mach(output_bfd,
ldfile_new_output_architecture,
ldfile_new_output_machine);
}
- }
+ }
}
next->sym= name;
name->flags |= SYM_CONSTRUCTOR;
constructor_name_list = next;
+
}
void
* intel coff loader emulation specific stuff
*/
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
/*#include "archures.h"*/
#include "ld.h"
* Written by Steve Chamberlain steve@cygnus.com
*
* $Id$
- *
- *
*/
-
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "config.h"
#include "ld.h"
int unix_relocate;
#ifdef GNU960
/* Indicates whether output file will be b.out (default) or coff */
-enum target_flavour_enum output_flavor = BFD_BOUT_FORMAT;
+enum target_flavour output_flavor = BFD_BOUT_FORMAT;
#endif
/* Force the make_executable to be output, even if there are non-fatal
*/
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ld.h"
#include "ldsym.h"
*/
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ld.h"
-#include "sysdep.h"
#include "bfd.h"
+#include "sysdep.h"
#include "ldsym.h"
#include "ldwarn.h"
#include "ldmisc.h"