diff options
author | Steve Chamberlain <sac@cygnus> | 1993-03-30 22:45:39 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1993-03-30 22:45:39 +0000 |
commit | 9fce28edd50c09017ccfc29f30508362081ed66f (patch) | |
tree | 1092783362865e3ac6bbfa90b7cab0fc0bf54ea8 /ld/ldlang.c | |
parent | 01b4d31847394cba8639b28b75c9680dd75ed7cf (diff) | |
download | gdb-9fce28edd50c09017ccfc29f30508362081ed66f.zip gdb-9fce28edd50c09017ccfc29f30508362081ed66f.tar.gz gdb-9fce28edd50c09017ccfc29f30508362081ed66f.tar.bz2 |
Support for linking and loading at different places:
* ldlex.l: Add "AT" keyword.
* ldgram.y: Cleanup, and parse AT.
* ldlang.c (print_output_section_statement): Print output address
of section in map. (lang_size_sections): Fill sections' lma with
load address.
* ldlang.h (lang_output_section_statement_type): Add load_base
information.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 588660b..151fe58 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -95,6 +95,10 @@ extern ld_config_type config; extern boolean had_script; extern boolean write_map; + +etree_type *base; /* Relocation base - or null */ + + #ifdef __STDC__ #define cat(a,b) a##b #else @@ -1091,6 +1095,12 @@ DEFUN (print_output_section_statement, (output_section_statement), fprintf (config.map_file, "No attached output section"); } print_nl (); + if (output_section_statement->load_base) + { + int b = exp_get_value_int(output_section_statement->load_base, + 0, "output base", lang_final_phase_enum); + printf("Output address %08x\n", b); + } if (output_section_statement->section_alignment >= 0 || output_section_statement->section_alignment >= 0) { @@ -1583,6 +1593,11 @@ DEFUN (lang_size_sections, (s, output_section_statement, prev, fill, dot = align_power (dot, os->bfd_section->alignment_power); bfd_set_section_vma (0, os->bfd_section, dot); + + if (os->load_base) { + os->bfd_section->lma + = exp_get_value_int(os->load_base, 0,"load base", lang_final_phase_enum); + } } @@ -1609,18 +1624,18 @@ DEFUN (lang_size_sections, (s, output_section_statement, prev, fill, { os->region->current = dot; /* Make sure this isn't silly */ - if (os->region->current > - os->region->origin + - os->region->length) - { - einfo ("%X%P: Region %s is full (%B section %s)\n", - os->region->name, - os->bfd_section->owner, - os->bfd_section->name); - /* Reset the region pointer */ - os->region->current = 0; + if (( os->region->current + > os->region->origin + os->region->length) + || ( os->region->origin > os->region->current )) + { + einfo ("%X%P: Region %s is full (%B section %s)\n", + os->region->name, + os->bfd_section->owner, + os->bfd_section->name); + /* Reset the region pointer */ + os->region->current = 0; - } + } } } @@ -2319,13 +2334,14 @@ DEFUN (lang_enter_output_section_statement, address_exp, flags, block_value, - align, subalign), + align, subalign, base), char *output_section_statement_name AND etree_type * address_exp AND int flags AND bfd_vma block_value AND etree_type *align AND - etree_type *subalign) + etree_type *subalign AND + etree_type *base) { lang_output_section_statement_type *os; @@ -2361,8 +2377,11 @@ DEFUN (lang_enter_output_section_statement, os->section_alignment = topower( exp_get_value_int(align, -1, "section alignment", 0)); + + os->load_base = base; } + void DEFUN_VOID (lang_final) { @@ -2765,3 +2784,4 @@ DEFUN (lang_add_output_format, (format), { output_target = format; } + |