aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-08-25 20:44:09 +0000
committerNick Clifton <nickc@redhat.com>2000-08-25 20:44:09 +0000
commitc13b1b775b2ff3918d53d0babed8247d8d34593c (patch)
tree5b3b8deeea03ce9d24c1ca49699041254475b7c0 /ld/ldlang.c
parentdcb0bd0eef10207754cb0fa64af3f2b965a1a589 (diff)
downloadgdb-c13b1b775b2ff3918d53d0babed8247d8d34593c.zip
gdb-c13b1b775b2ff3918d53d0babed8247d8d34593c.tar.gz
gdb-c13b1b775b2ff3918d53d0babed8247d8d34593c.tar.bz2
When choosing the target for a particular endianness, do nothing if the target
is not supported.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index c3420c5..baaf7ed 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1728,32 +1728,37 @@ open_output (name)
/* Get the chosen target. */
target = bfd_search_for_target (get_target, (void *) output_target);
- if (command_line.endian == ENDIAN_BIG)
- desired_endian = BFD_ENDIAN_BIG;
- else
- desired_endian = BFD_ENDIAN_LITTLE;
-
- /* See if the target has the wrong endianness. This should not happen
- if the linker script has provided big and little endian alternatives,
- but some scrips don't do this. */
- if (target->byteorder != desired_endian)
+ /* If the target is not supported, we cannot do anything. */
+ if (target != NULL)
{
- /* If it does, then see if the target provides
- an alternative with the correct endianness. */
- if (target->alternative_target != NULL
- && (target->alternative_target->byteorder == desired_endian))
- output_target = target->alternative_target->name;
+ if (command_line.endian == ENDIAN_BIG)
+ desired_endian = BFD_ENDIAN_BIG;
else
+ desired_endian = BFD_ENDIAN_LITTLE;
+
+ /* See if the target has the wrong endianness. This should not happen
+ if the linker script has provided big and little endian alternatives,
+ but some scrips don't do this. */
+ if (target->byteorder != desired_endian)
{
- /* Try to find a target as similar as possible to the default
- target, but which has the desired endian characteristic. */
- (void) bfd_search_for_target (closest_target_match, (void *) target);
-
- /* Oh dear - we could not find any targets that satisfy our requirements. */
- if (winner == NULL)
- einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
+ /* If it does, then see if the target provides
+ an alternative with the correct endianness. */
+ if (target->alternative_target != NULL
+ && (target->alternative_target->byteorder == desired_endian))
+ output_target = target->alternative_target->name;
else
- output_target = winner->name;
+ {
+ /* Try to find a target as similar as possible to the default
+ target, but which has the desired endian characteristic. */
+ (void) bfd_search_for_target (closest_target_match, (void *) target);
+
+ /* Oh dear - we could not find any targets that satisfy our
+ requirements. */
+ if (winner == NULL)
+ einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
+ else
+ output_target = winner->name;
+ }
}
}
}
@@ -3155,14 +3160,15 @@ lang_do_assignments (s, output_section_statement, fill, dot)
dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
}
- if (os->load_base)
+ if (os->load_base)
{
/* If nothing has been placed into the output section then
it won't have a bfd_section. */
if (os->bfd_section)
{
os->bfd_section->lma
- = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum);
+ = exp_get_abs_int(os->load_base, 0,"load base",
+ lang_final_phase_enum);
}
}
}
@@ -3873,7 +3879,6 @@ lang_enter_output_section_statement (output_section_statement_name,
return os;
}
-
void
lang_final ()
{