aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1992-03-02 22:22:59 +0000
committerSteve Chamberlain <sac@cygnus>1992-03-02 22:22:59 +0000
commit76971f0da2260c069b0ae13740627dba1b39487b (patch)
treeb2584c6a655cf348429122bec9c33f0f9383023d /ld
parent4ef09e3613ecc3849c0008102fc3871324caf7fd (diff)
downloadgdb-76971f0da2260c069b0ae13740627dba1b39487b.zip
gdb-76971f0da2260c069b0ae13740627dba1b39487b.tar.gz
gdb-76971f0da2260c069b0ae13740627dba1b39487b.tar.bz2
Modifed to care about semi colons again, newlines are ignored - sorry
Per.
Diffstat (limited to 'ld')
-rwxr-xr-xld/a29k.sc-sh6
-rwxr-xr-xld/aout.sc-sh4
-rwxr-xr-xld/ebmon29k.sc-sh4
-rwxr-xr-xld/h8300hms.sc-sh19
-rwxr-xr-xld/h8300hms.sh4
-rwxr-xr-xld/i960.sc-sh8
-rw-r--r--ld/ldexp.c67
-rw-r--r--ld/ldgram.y39
-rwxr-xr-xld/m88kbcs.sc-sh22
9 files changed, 82 insertions, 91 deletions
diff --git a/ld/a29k.sc-sh b/ld/a29k.sc-sh
index e58af43..a43a5eb 100755
--- a/ld/a29k.sc-sh
+++ b/ld/a29k.sc-sh
@@ -14,7 +14,7 @@ SECTIONS
{
.text : {
*(.text)
- ${RELOCATING+ __etext = .}
+ ${RELOCATING+ __etext = .};
*(.lit)
*(.shdata)
} ${RELOCATING+ > text}
@@ -24,13 +24,13 @@ SECTIONS
.talias : { } ${RELOCATING+ > talias}
.data : {
*(.data)
- ${RELOCATING+ __edata = .}
+ ${RELOCATING+ __edata = .};
} ${RELOCATING+ > data}
.bss SIZEOF(.data) + ADDR(.data) :
{
*(.bss)
*(COMMON)
- ${RELOCATING+ __end = ALIGN(0x8)}
+ ${RELOCATING+ __end = ALIGN(0x8)};
}
.mstack : { } ${RELOCATING+ > mstack}
.rstack : { } ${RELOCATING+ > rstack}
diff --git a/ld/aout.sc-sh b/ld/aout.sc-sh
index e118daf..7fcea05 100755
--- a/ld/aout.sc-sh
+++ b/ld/aout.sc-sh
@@ -22,8 +22,8 @@ SECTIONS
{
*(.bss)
*(COMMON)
- ${RELOCATING+_end = .}
- ${RELOCATING+__end = .}
+ ${RELOCATING+_end = . };
+ ${RELOCATING+__end = . };
}
}
EOF
diff --git a/ld/ebmon29k.sc-sh b/ld/ebmon29k.sc-sh
index 1b0fa6d..62050ee 100755
--- a/ld/ebmon29k.sc-sh
+++ b/ld/ebmon29k.sc-sh
@@ -6,7 +6,7 @@ SECTIONS {
.text ${RELOCATING+${TEXT_START_ADDR}} :
{
*(.text);
- ${RELOCATING+_etext = .}
+ ${RELOCATING+_etext = .};
}
data ${RELOCATING+0x80002000} :
{
@@ -21,7 +21,7 @@ SECTIONS {
{
*(COMMON)
*(.bss);
- ${RELOCATING+_end = .;}
+ ${RELOCATING+_end = .};
}
}
EOF
diff --git a/ld/h8300hms.sc-sh b/ld/h8300hms.sc-sh
index f48b11b..2c66850 100755
--- a/ld/h8300hms.sc-sh
+++ b/ld/h8300hms.sc-sh
@@ -1,11 +1,12 @@
cat <<EOF
-OUTPUT_FORMAT(${OUTPUT_FORMAT})
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
MEMORY {
rom : o = 0x0000, l = 0x7fe0
duart : o = 0x7fe0, l = 16
- ram : o = 0x8000, l = 29k
+ ram : o = 0x8000, l = 28k
+ topram: o = 0x8000+28k, l = 1k
hmsram: o = 0xfb80, l = 512
}
@@ -15,17 +16,27 @@ SECTIONS
{
*(.text)
*(.strings)
+ _etext = .;
} ${RELOCATING+ > ram}
.data :
{
*(.data)
+ _edata = .;
} ${RELOCATING+ > ram}
.bss :
{
- ${RELOCATING+ _bss_start = .}
+ ${RELOCATING+ _bss_start = .};
*(.bss)
*(COMMON)
- ${RELOCATING+ _end = .}
+ ${RELOCATING+ _end = .};
} ${RELOCATING+ >ram}
+.stack :
+ {
+ *(.stack)
+ } ${RELOCATING+ > topram}
}
EOF
+
+
+
+
diff --git a/ld/h8300hms.sh b/ld/h8300hms.sh
index 67af09b..fbc2627 100755
--- a/ld/h8300hms.sh
+++ b/ld/h8300hms.sh
@@ -1,7 +1,7 @@
EMULATION_NAME=h8300hms
SCRIPT_NAME=h8300hms
OUTPUT_FORMAT="coff-h8300"
-TEXT_START_ADDR=??
-PAGE_SIZE=??
+TEXT_START_ADDR=0x8000
+PAGE_SIZE=128
ARCH=h8300
TEMPLATE_NAME=h8300hms
diff --git a/ld/i960.sc-sh b/ld/i960.sc-sh
index 0e24bb4..6d778a6 100755
--- a/ld/i960.sc-sh
+++ b/ld/i960.sc-sh
@@ -5,19 +5,19 @@ SECTIONS
{
${GLD_STYLE+ CREATE_OBJECT_SYMBOLS}
*(.text)
- ${RELOCATING+ _etext = .}
+ ${RELOCATING+ _etext = .};
}
.data :
{
*(.data)
- ${RELOCATING+ _edata = .}
+ ${RELOCATING+ _edata = .};
}
.bss :
{
- ${RELOCATING+ _bss_start = .}
+ ${RELOCATING+ _bss_start = .};
*(.bss)
*(COMMON)
- ${RELOCATING+ _end = .}
+ ${RELOCATING+ _end = .};
}
}
EOF
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 247de62..e107110 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -50,7 +50,7 @@ extern ld_config_type config;
extern lang_input_statement_type *script_file;
extern unsigned int defined_global_sym_count;
-
+ extern lang_output_section_statement_type *abs_output_section;
extern bfd_vma print_dot;
@@ -121,21 +121,20 @@ static void
DEFUN(make_abs,(ptr),
etree_value_type *ptr)
{
- if (ptr->section != (lang_output_section_statement_type *)NULL) {
asection *s = ptr->section->bfd_section;
ptr->value += s->vma;
- ptr->section = (lang_output_section_statement_type *)NULL;
- }
-
+ ptr->section = abs_output_section;
}
static
DEFUN(etree_value_type new_abs,(value),
bfd_vma value)
{
+
+
etree_value_type new;
new.valid = true;
- new.section = (lang_output_section_statement_type *)NULL;
+ new.section = abs_output_section;
new.value = value;
return new;
}
@@ -189,9 +188,9 @@ DEFUN(etree_value_type
new.valid = true;
new.value = value;
new.section = section;
- if (new.section != (lang_output_section_statement_type *)NULL) {
+
new.value -= section->bfd_section->vma;
- }
+
return new;
}
@@ -216,8 +215,8 @@ DEFUN(fold_binary,(tree, current_section, allocation_done, dot, dotp),
/* If values are from different sections, or this is an */
/* absolute expression, make both source args absolute */
if (result.section != other.section ||
- current_section == (lang_output_section_statement_type *)NULL) {
-
+ current_section == abs_output_section)
+ {
make_abs(&result);
make_abs(&other);
}
@@ -230,13 +229,13 @@ DEFUN(fold_binary,(tree, current_section, allocation_done, dot, dotp),
if (other.value == 0) {
einfo("%F%S % by zero\n");
}
- result.value %= other.value;
+ result.value = (int)result.value % (int)other.value;
break;
case '/':
if (other.value == 0) {
einfo("%F%S / by zero\n");
}
- result.value /= other.value;
+ result.value = (int)result.value / (int) other.value;
break;
#define BOP(x,y) case x : result.value = result.value y other.value;break;
BOP('+',+);
@@ -320,11 +319,14 @@ DEFUN(fold_name, (tree, current_section, allocation_done, dot),
if (sdefp) {
asymbol *sdef = *sdefp;
+#if 0
if (sdef->section == (asection *)NULL) {
/* This is an absolute symbol */
result = new_abs(sdef->value);
}
- else {
+ else
+#endif
+ {
lang_output_section_statement_type *os =
lang_output_section_statement_lookup(
sdef->section->output_section->name);
@@ -334,8 +336,8 @@ DEFUN(fold_name, (tree, current_section, allocation_done, dot),
if (sdef->the_bfd->usrdata &&
((lang_input_statement_type*)(sdef->the_bfd->usrdata))->just_syms_flag == true)
{
- result = new_abs(sdef->value + (sdef->section ?
- sdef->section->vma : 0));
+ result = new_abs(sdef->value +sdef->section->vma);
+
}
else {
result = new_rel(sdef->value + sdef->section->output_offset, os);
@@ -519,36 +521,19 @@ DEFUN(exp_fold_tree,(tree, current_section, allocation_done,
else
{
def_ptr = (asymbol **)ldmalloc((bfd_size_type)(sizeof(asymbol **)));
- def = (asymbol
- *)bfd_make_empty_symbol(script_file->the_bfd);
+ def = (asymbol *)bfd_make_empty_symbol(script_file->the_bfd);
-
+ def->flags = 0;
+
+ sy->sdefs_chain = def_ptr;
*def_ptr = def;
}
def->value = result.value;
- if (result.section !=
- (lang_output_section_statement_type *)NULL) {
- if (current_section !=
- (lang_output_section_statement_type *)NULL) {
-
+
def->section = result.section->bfd_section;
def->flags = BSF_GLOBAL | BSF_EXPORT;
- }
- else {
- /* Force to absolute */
- def->value += result.section->bfd_section->vma;
- def->section = &bfd_abs_section;
- def->flags = BSF_GLOBAL | BSF_EXPORT ;
- }
-
-
- }
- else {
- def->section = &bfd_abs_section;
- def->flags = BSF_GLOBAL | BSF_EXPORT ;
- }
def->udata = (PTR)NULL;
@@ -597,7 +582,8 @@ DEFUN(exp_binop,(code, lhs, rhs),
value.binary.lhs = lhs;
value.binary.rhs = rhs;
value.type.node_class = etree_binary;
- r = exp_fold_tree_no_dot(&value, (lang_output_section_statement_type *)NULL,
+ r = exp_fold_tree_no_dot(&value,
+ abs_output_section,
lang_first_phase_enum );
if (r.valid)
{
@@ -669,8 +655,9 @@ DEFUN(exp_nameop,(code, name),
value.name.type.node_class = etree_name;
- r = exp_fold_tree_no_dot(&value,(lang_output_section_statement_type *)NULL,
- lang_first_phase_enum);
+ r = exp_fold_tree_no_dot(&value,
+ (lang_output_section_statement_type *)NULL,
+ lang_first_phase_enum);
if (r.valid) {
return exp_intop(r.value);
}
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 039a07d..ce0f4a1 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -87,7 +87,7 @@ boolean ldgram_had_equals = false;
char *name;
int token;
union etree_union *etree;
- asection *section;
+struct sec *section;
struct lang_output_section_statement_struct *output_section_statement;
union lang_statement_union **statement_ptr;
int lineno;
@@ -142,7 +142,7 @@ boolean ldgram_had_equals = false;
%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 CONSTRUCTORS
+%token LENGTH CREATE_OBJECT_SYMBOLS INPUT OUTPUT CONSTRUCTORS
%type <token> assign_op
%type <name> filename
@@ -153,14 +153,12 @@ ld_config_type config;
%%
-
-
file: command_line { lang_final(); };
-
filename:
NAME;
+
command_line:
command_line command_line_option
|
@@ -175,12 +173,12 @@ command_line_option:
| OPTION_Bstatic { }
| OPTION_v
{
- ldversion();
+ ldversion(0);
option_v = true;
}
| OPTION_V
{
- ldversion();
+ ldversion(1);
option_v = true;
}
| OPTION_t {
@@ -361,7 +359,7 @@ ifile_p1:
| low_level_library
| floating_point_support
| statement_anywhere
- | ';'
+ | ';'
| TARGET_K '(' NAME ')'
{ lang_add_target($3); }
| SEARCH_DIR '(' filename ')'
@@ -392,12 +390,13 @@ input_list:
;
sections:
- SECTIONS '{'sec_or_group_p1 '}'
+ SECTIONS '{'sec_or_group_p1 '}'
;
sec_or_group_p1:
sec_or_group_p1 section
| sec_or_group_p1 statement_anywhere
+ | sec_or_group_p1
|
;
@@ -439,10 +438,11 @@ input_section_spec:
statement:
statement assignment end
+ | statement ';'
+ | statement
| statement CREATE_OBJECT_SYMBOLS
{
lang_add_attribute(lang_object_symbols_statement_enum); }
- | statement ';'
| statement CONSTRUCTORS
{
lang_add_attribute(lang_constructors_statement_enum); }
@@ -506,7 +506,7 @@ assign_op:
;
-end: ';' | ','
+end: ';' | ','
;
@@ -528,7 +528,7 @@ opt_comma:
memory:
- MEMORY '{' memory_spec memory_spec_list '}'
+ MEMORY '{' memory_spec memory_spec_list '}'
;
memory_spec_list:
@@ -613,7 +613,7 @@ floating_point_support:
exp :
'-' exp %prec UNARY
{ $$ = exp_unop('-', $2); }
- | '(' exp ')'
+ | '(' exp ')'
{ $$ = $2; }
| NEXT '(' exp ')' %prec UNARY
{ $$ = exp_unop($1,$3); }
@@ -702,14 +702,7 @@ opt_type:
| { $$ = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; }
;
-opt_things:
- {
-
- }
- ;
-
-
-
+opt_things: ;
opt_exp:
@@ -719,7 +712,7 @@ opt_exp:
;
opt_block:
- BLOCK '(' exp ')'
+ BLOCK '(' exp ')'
{ $$ = exp_get_value_int($3,
1L,
"block",
@@ -729,7 +722,7 @@ opt_block:
;
memspec_opt:
- '>' NAME
+ '>' NAME
{ $$ = $2; }
| { $$ = "*default*"; }
;
diff --git a/ld/m88kbcs.sc-sh b/ld/m88kbcs.sc-sh
index 65112be..c7fe189 100755
--- a/ld/m88kbcs.sc-sh
+++ b/ld/m88kbcs.sc-sh
@@ -10,32 +10,32 @@ SECTIONS
.text ${RELOCATING+ 0x10000 + SIZEOF_HEADERS} :
{
CREATE_OBJECT_SYMBOLS
- ${RELOCATING+ __.text.start = .}
- ${RELOCATING+ __.init.start = .}
+ ${RELOCATING+ __.text.start = .};
+ ${RELOCATING+ __.init.start = .};
${RELOCATING+ LONG(0xf400c001)}
- ${RELOCATING+ __.init.end = .}
+ ${RELOCATING+ __.init.end = .};
*(.text)
- ${RELOCATING+ __.tdesc_start = .}
+ ${RELOCATING+ __.tdesc_start = .};
${RELOCATING+ *(.tdesc)}
- ${RELOCATING+ __.text_end = .}
- ${RELOCATING+ __.initp.start = .}
- ${RELOCATING+ __.initp.end =.}
+ ${RELOCATING+ __.text_end = .} ;
+ ${RELOCATING+ __.initp.start = .};
+ ${RELOCATING+ __.initp.end =.};
- ${RELOCATING+_etext =.}
+ ${RELOCATING+_etext =.};
}
.data ${RELOCATING+ SIZEOF(.text) + ADDR(.text) + 0x400000} :
{
*(.data)
${CONSTRUCTING+CONSTRUCTORS}
*(.comment)
- ${RELOCATING+_edata = .}
+ ${RELOCATING+_edata = .};
}
.bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
{
*(.bss)
*(COMMON)
- ${RELOCATING+ _end = .}
- ${RELOCATING+ __end = .}
+ ${RELOCATING+ _end = .};
+ ${RELOCATING+ __end = .};
}
}
EOF