Per.
{
.text : {
*(.text)
- ${RELOCATING+ __etext = .}
+ ${RELOCATING+ __etext = .};
*(.lit)
*(.shdata)
} ${RELOCATING+ > text}
.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}
{
*(.bss)
*(COMMON)
- ${RELOCATING+_end = .}
- ${RELOCATING+__end = .}
+ ${RELOCATING+_end = . };
+ ${RELOCATING+__end = . };
}
}
EOF
.text ${RELOCATING+${TEXT_START_ADDR}} :
{
*(.text);
- ${RELOCATING+_etext = .}
+ ${RELOCATING+_etext = .};
}
data ${RELOCATING+0x80002000} :
{
{
*(COMMON)
*(.bss);
- ${RELOCATING+_end = .;}
+ ${RELOCATING+_end = .};
}
}
EOF
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
}
{
*(.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
+
+
+
+
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
{
${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
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;
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;
}
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;
}
/* 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);
}
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('+',+);
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);
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);
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;
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)
{
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);
}
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;
%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
%%
-
-
file: command_line { lang_final(); };
-
filename:
NAME;
+
command_line:
command_line command_line_option
|
| OPTION_Bstatic { }
| OPTION_v
{
- ldversion();
+ ldversion(0);
option_v = true;
}
| OPTION_V
{
- ldversion();
+ ldversion(1);
option_v = true;
}
| OPTION_t {
| low_level_library
| floating_point_support
| statement_anywhere
- | ';'
+ | ';'
| TARGET_K '(' NAME ')'
{ lang_add_target($3); }
| SEARCH_DIR '(' filename ')'
;
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
|
;
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); }
;
-end: ';' | ','
+end: ';' | ','
;
memory:
- MEMORY '{' memory_spec memory_spec_list '}'
+ MEMORY '{' memory_spec memory_spec_list '}'
;
memory_spec_list:
exp :
'-' exp %prec UNARY
{ $$ = exp_unop('-', $2); }
- | '(' exp ')'
+ | '(' exp ')'
{ $$ = $2; }
| NEXT '(' exp ')' %prec UNARY
{ $$ = exp_unop($1,$3); }
| { $$ = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; }
;
-opt_things:
- {
-
- }
- ;
-
-
-
+opt_things: ;
opt_exp:
;
opt_block:
- BLOCK '(' exp ')'
+ BLOCK '(' exp ')'
{ $$ = exp_get_value_int($3,
1L,
"block",
;
memspec_opt:
- '>' NAME
+ '>' NAME
{ $$ = $2; }
| { $$ = "*default*"; }
;
.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