aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-10-26 18:41:52 +0000
committerMark Mitchell <mark@codesourcery.com>2004-10-26 18:41:52 +0000
commitba916c8af2642aebace1778a707e90a6a4f9095f (patch)
treecb164ef2f690eeb1dda279b88015e5e9aa59073d /ld/ldlang.c
parent1ec5cd372135a64c39eeaa32103cad2913e1754a (diff)
downloadfsf-binutils-gdb-ba916c8af2642aebace1778a707e90a6a4f9095f.zip
fsf-binutils-gdb-ba916c8af2642aebace1778a707e90a6a4f9095f.tar.gz
fsf-binutils-gdb-ba916c8af2642aebace1778a707e90a6a4f9095f.tar.bz2
* Makefile.in (earmsymbian.c): Depend on armbpabi.sc, not elf.sc.
* ldexp.h (segment_type): New type. (segments): New variable. * ldexp.c (segments): New variable. (exp_print_token): Handle SEGMENT_START. (fold_binary): Likewise. * ldgram.y (SEGMENT_START): Declare it as a token. (exp): Handle SEGMENT_START. * ldlang.h (lang_address_statement_type): Add segment field. (lang_section_start): Change prototype. * ldlang.c (map_input_to_output_sections): Do not process section assignments if a corresponding SEGMENT_START has already been seen. (lang_section_start): Add segment parameter. * ldlex.l (SEGMENT_START): Add it. * lexsup.c (seg_segment_start): New function. (parse_args): Use it for -Tbss, -Tdata, and -Ttext. * ld.texinfo (SEGMENT_START): Document it. * emulparams/armsymbian.sh (EMBEDDED): Set it. * scripttempl/armbpabi.sc: Use SEGMENT_START to control segment base addresses. Do not map relocations. * NEWS: Mention SEGMENT_START.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 3d1e5a41..c3a4934 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2652,16 +2652,27 @@ map_input_to_output_sections
FAIL ();
break;
case lang_address_statement_enum:
- /* Mark the specified section with the supplied address. */
- {
- lang_output_section_statement_type *aos
- = (lang_output_section_statement_lookup
- (s->address_statement.section_name));
-
- if (aos->bfd_section == NULL)
- init_os (aos);
- aos->addr_tree = s->address_statement.address;
- }
+ /* Mark the specified section with the supplied address.
+
+ If this section was actually a segment marker, then the
+ directive is ignored if the linker script explicitly
+ processed the segment marker. Originally, the linker
+ treated segment directives (like -Ttext on the
+ command-line) as section directives. We honor the
+ section directive semantics for backwards compatibilty;
+ linker scripts that do not specifically check for
+ SEGMENT_START automatically get the old semantics. */
+ if (!s->address_statement.segment
+ || !s->address_statement.segment->used)
+ {
+ lang_output_section_statement_type *aos
+ = (lang_output_section_statement_lookup
+ (s->address_statement.section_name));
+
+ if (aos->bfd_section == NULL)
+ init_os (aos);
+ aos->addr_tree = s->address_statement.address;
+ }
break;
}
}
@@ -4971,13 +4982,15 @@ lang_add_wild (struct wildcard_spec *filespec,
}
void
-lang_section_start (const char *name, etree_type *address)
+lang_section_start (const char *name, etree_type *address,
+ const segment_type *segment)
{
lang_address_statement_type *ad;
ad = new_stat (lang_address_statement, stat_ptr);
ad->section_name = name;
ad->address = address;
+ ad->segment = segment;
}
/* Set the start symbol to NAME. CMDLINE is nonzero if this is called