aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-10-10 15:59:10 +0000
committerJakub Jelinek <jakub@redhat.com>2002-10-10 15:59:10 +0000
commit599917b82b8592664e680ac7fca4260f0160e169 (patch)
treee3ea9c21b833848b833549fa6130c3ee0a63a850 /ld/ldlang.c
parentac62e7a36867559d7a8a31a73328ff27278bb122 (diff)
downloadgdb-599917b82b8592664e680ac7fca4260f0160e169.zip
gdb-599917b82b8592664e680ac7fca4260f0160e169.tar.gz
gdb-599917b82b8592664e680ac7fca4260f0160e169.tar.bz2
* ldfile.c (ldfile_try_open_bfd): When searching skip linker scripts if
they have OUTPUT_FORMAT not matching actual output format. * ldlang.c (lang_get_output_target): New function. (open_output): Use it. * ldlang.h (lang_get_output_target): New prototype.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 1df0532..8ebd1bd 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1787,6 +1787,29 @@ get_first_input_target ()
return target;
}
+const char *
+lang_get_output_target ()
+{
+ const char *target;
+
+ /* Has the user told us which output format to use? */
+ if (output_target != (char *) NULL)
+ return output_target;
+
+ /* No - has the current target been set to something other than
+ the default? */
+ if (current_target != default_target)
+ return current_target;
+
+ /* No - can we determine the format of the first input file? */
+ target = get_first_input_target ();
+ if (target != NULL)
+ return target;
+
+ /* Failed - use the default output target. */
+ return default_target;
+}
+
/* Open the output file. */
static bfd *
@@ -1795,24 +1818,7 @@ open_output (name)
{
bfd *output;
- /* Has the user told us which output format to use? */
- if (output_target == (char *) NULL)
- {
- /* No - has the current target been set to something other than
- the default? */
- if (current_target != default_target)
- output_target = current_target;
-
- /* No - can we determine the format of the first input file? */
- else
- {
- output_target = get_first_input_target ();
-
- /* Failed - use the default output target. */
- if (output_target == NULL)
- output_target = default_target;
- }
- }
+ output_target = lang_get_output_target ();
/* Has the user requested a particular endianness on the command
line? */