skip = 1;
}
free (arg1);
- if (arg2) free (arg2);
- if (arg3) free (arg3);
+ free (arg2);
+ free (arg3);
break;
case NAME:
case LNAME:
free (yylval.name);
break;
case INT:
- if (yylval.bigint.str)
- free (yylval.bigint.str);
+ free (yylval.bigint.str);
break;
}
token = yylex ();
search_arch_type *arch;
bfd_boolean found = FALSE;
- /* Try to open <filename><suffix> or lib<filename><suffix>.a */
+ /* If extra_search_path is set, entry->filename is a relative path.
+ Search the directory of the current linker script before searching
+ other paths. */
+ if (entry->extra_search_path)
+ {
+ char *path = concat (entry->extra_search_path, slash, entry->filename,
+ (const char *)0);
+ if (ldfile_try_open_bfd (path, entry))
+ {
+ entry->filename = path;
+ entry->flags.search_dirs = FALSE;
+ return;
+ }
+
+ free (path);
+ }
+
+ /* Try to open <filename><suffix> or lib<filename><suffix>.a. */
for (arch = search_arch_head; arch != NULL; arch = arch->next)
{
found = ldfile_open_file_search (arch->name, entry, "lib", ".a");