X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Fldfile.c;h=fcadc08c73ff637be0ad0ebb99ddd9dbfc8eb621;hb=57e5e645010430b3d73f8c6a757d09f48dc8f8d5;hp=96f9ecc0157d645ff2228243d373f1c1d5c393dd;hpb=0e1862bb401f47716446aef143b2bf7a4563f541;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/ldfile.c b/ld/ldfile.c index 96f9ecc015..fcadc08c73 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -1,5 +1,5 @@ /* Linker file opening and searching. - Copyright (C) 1991-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2019 Free Software Foundation, Inc. This file is part of the GNU Binutils. @@ -38,19 +38,19 @@ #include "plugin.h" #endif /* ENABLE_PLUGINS */ -bfd_boolean ldfile_assumed_script = FALSE; -const char * ldfile_output_machine_name = ""; +bfd_boolean ldfile_assumed_script = FALSE; +const char *ldfile_output_machine_name = ""; unsigned long ldfile_output_machine; enum bfd_architecture ldfile_output_architecture; -search_dirs_type * search_head; +search_dirs_type *search_head; #ifdef VMS -static char * slash = ""; +static char *slash = ""; #else -#if defined (_WIN32) && ! defined (__CYGWIN32__) -static char * slash = "\\"; +#if defined (_WIN32) && !defined (__CYGWIN32__) +static char *slash = "\\"; #else -static char * slash = "/"; +static char *slash = "/"; #endif #endif @@ -112,6 +112,8 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline) now. */ if (name[0] == '=') new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); + else if (CONST_STRNEQ (name, "$SYSROOT")) + new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL); else new_dirs->name = xstrdup (name); } @@ -172,12 +174,12 @@ ldfile_try_open_bfd (const char *attempt, if (check != NULL) { - if (! bfd_check_format (check, bfd_object)) + if (!bfd_check_format (check, bfd_object)) { if (check == entry->the_bfd && entry->flags.search_dirs && bfd_get_error () == bfd_error_file_not_recognized - && ! ldemul_unrecognized_file (entry)) + && !ldemul_unrecognized_file (entry)) { int token, skip = 0; char *arg, *arg1, *arg2, *arg3; @@ -284,9 +286,10 @@ ldfile_try_open_bfd (const char *attempt, && !bfd_arch_get_compatible (check, link_info.output_bfd, command_line.accept_unknown_input_arch) /* XCOFF archives can have 32 and 64 bit objects. */ - && ! (bfd_get_flavour (check) == bfd_target_xcoff_flavour - && bfd_get_flavour (link_info.output_bfd) == bfd_target_xcoff_flavour - && bfd_check_format (entry->the_bfd, bfd_archive))) + && !(bfd_get_flavour (check) == bfd_target_xcoff_flavour + && (bfd_get_flavour (link_info.output_bfd) + == bfd_target_xcoff_flavour) + && bfd_check_format (entry->the_bfd, bfd_archive))) { if (command_line.warn_search_mismatch) einfo (_("%P: skipping incompatible %s " @@ -333,7 +336,7 @@ ldfile_open_file_search (const char *arch, /* If this is not an archive, try to open it in the current directory first. */ - if (! entry->flags.maybe_archive) + if (!entry->flags.maybe_archive) { if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)) { @@ -393,7 +396,7 @@ ldfile_open_file (lang_input_statement_type *entry) if (entry->the_bfd != NULL) return; - if (! entry->flags.search_dirs) + if (!entry->flags.search_dirs) { if (ldfile_try_open_bfd (entry->filename, entry)) return; @@ -595,7 +598,7 @@ ldfile_open_command_file_1 (const char *name, bfd_boolean default_only) if (ldlex_input_stack == NULL) { bfd_set_error (bfd_error_system_call); - einfo (_("%P%F: cannot open linker script file %s: %E\n"), name); + einfo (_("%F%P: cannot open linker script file %s: %E\n"), name); return; } @@ -627,8 +630,8 @@ void ldfile_add_arch (const char *in_name) { char *name = xstrdup (in_name); - search_arch_type *new_arch = (search_arch_type *) - xmalloc (sizeof (search_arch_type)); + search_arch_type *new_arch + = (search_arch_type *) xmalloc (sizeof (search_arch_type)); ldfile_output_machine_name = in_name; @@ -660,5 +663,5 @@ ldfile_set_output_arch (const char *string, enum bfd_architecture defarch) else if (defarch != bfd_arch_unknown) ldfile_output_architecture = defarch; else - einfo (_("%P%F: cannot represent machine `%s'\n"), string); + einfo (_("%F%P: cannot represent machine `%s'\n"), string); }