From 3e629c2f3569c9fce81bb2c40465b23dc1adcf06 Mon Sep 17 00:00:00 2001 From: amodra Date: Wed, 11 Jul 2007 22:58:08 +0000 Subject: [PATCH] * emultempl/spuelf.em (embedded_spu_file): Test for NULL path before calling base_name, not after. --- ld/ChangeLog | 5 +++++ ld/emultempl/spuelf.em | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 96158f67f6..bf73bb4793 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2007-07-12 Alan Modra + + * emultempl/spuelf.em (embedded_spu_file): Test for NULL path + before calling base_name, not after. + 2007-07-10 Alan Modra * scripttempl/elf.sc (DISCARDED): Renamed from STACKNOTE. Add diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em index abcb6b5bcd..2235143bd2 100644 --- a/ld/emultempl/spuelf.em +++ b/ld/emultempl/spuelf.em @@ -345,19 +345,19 @@ embedded_spu_file (lang_input_statement_type *entry, const char *flags) for (search = (lang_input_statement_type *) input_file_chain.head; search != NULL; search = (lang_input_statement_type *) search->next_real_file) - { - const char *infile = base_name (search->filename); + if (search->filename != NULL) + { + const char *infile = base_name (search->filename); - if (infile != NULL - && strncmp (infile, "crtbegin", 8) == 0) - { - if (infile[8] == 'S') - flags = concat (flags, " -fPIC", NULL); - else if (infile[8] == 'T') - flags = concat (flags, " -fpie", NULL); - break; - } - } + if (strncmp (infile, "crtbegin", 8) == 0) + { + if (infile[8] == 'S') + flags = concat (flags, " -fPIC", NULL); + else if (infile[8] == 'T') + flags = concat (flags, " -fpie", NULL); + break; + } + } /* Use fork() and exec() rather than system() so that we don't need to worry about quoting args. */ -- 2.11.0