Commit 7142ae77 by David Edelsohn Committed by David Edelsohn

re PR other/18720 (collect2 uses wrong search order if -brtl specified)

        PR target/18720
        * collect2.c (main): Set aixrtl_flag for -brtl option.
        (resolve_lib_name): Search for .so file extension before .a
        if aixrtl_flag set.

From-SVN: r93119
parent 96b5a6c7
2005-01-09 David Edelsohn <edelsohn@gnu.org>
PR target/18720
* collect2.c (main): Set aixrtl_flag for -brtl option.
(resolve_lib_name): Search for .so file extension before .a
if aixrtl_flag set.
2005-01-09 Dorit Naishlos <dorit@il.ibm.com> 2005-01-09 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c (vect_enhance_data_refs_alignment): Add dump prints. * tree-vectorizer.c (vect_enhance_data_refs_alignment): Add dump prints.
......
...@@ -185,6 +185,7 @@ static const char *demangle_flag; ...@@ -185,6 +185,7 @@ static const char *demangle_flag;
#ifdef COLLECT_EXPORT_LIST #ifdef COLLECT_EXPORT_LIST
static int export_flag; /* true if -bE */ static int export_flag; /* true if -bE */
static int aix64_flag; /* true if -b64 */ static int aix64_flag; /* true if -b64 */
static int aixrtl_flag; /* true if -brtl */
#endif #endif
int debug; /* true if -debug */ int debug; /* true if -debug */
...@@ -242,7 +243,6 @@ static struct path_prefix cmdline_lib_dirs; /* directories specified with -L */ ...@@ -242,7 +243,6 @@ static struct path_prefix cmdline_lib_dirs; /* directories specified with -L */
static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */ static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */
static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs, static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs,
&libpath_lib_dirs, NULL}; &libpath_lib_dirs, NULL};
static const char *const libexts[3] = {"a", "so", NULL}; /* possible library extensions */
#endif #endif
static void handler (int); static void handler (int);
...@@ -1087,6 +1087,8 @@ main (int argc, char **argv) ...@@ -1087,6 +1087,8 @@ main (int argc, char **argv)
export_flag = 1; export_flag = 1;
else if (arg[2] == '6' && arg[3] == '4') else if (arg[2] == '6' && arg[3] == '4')
aix64_flag = 1; aix64_flag = 1;
else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l')
aixrtl_flag = 1;
break; break;
#endif #endif
...@@ -2594,6 +2596,8 @@ resolve_lib_name (const char *name) ...@@ -2594,6 +2596,8 @@ resolve_lib_name (const char *name)
{ {
char *lib_buf; char *lib_buf;
int i, j, l = 0; int i, j, l = 0;
/* Library extensions for AIX dynamic linking. */
const char * const libexts[2] = {"a", "so"};
for (i = 0; libpaths[i]; i++) for (i = 0; libpaths[i]; i++)
if (libpaths[i]->max_len > l) if (libpaths[i]->max_len > l)
...@@ -2612,14 +2616,15 @@ resolve_lib_name (const char *name) ...@@ -2612,14 +2616,15 @@ resolve_lib_name (const char *name)
const char *p = ""; const char *p = "";
if (list->prefix[strlen(list->prefix)-1] != '/') if (list->prefix[strlen(list->prefix)-1] != '/')
p = "/"; p = "/";
for (j = 0; libexts[j]; j++) for (j = 0; j < 2; j++)
{ {
sprintf (lib_buf, "%s%slib%s.%s", sprintf (lib_buf, "%s%slib%s.%s",
list->prefix, p, name, libexts[j]); list->prefix, p, name,
if (debug) fprintf (stderr, "searching for: %s\n", lib_buf); libexts[(j + aixrtl_flag) % 2]);
if (debug) fprintf (stderr, "searching for: %s\n", lib_buf);
if (file_exists (lib_buf)) if (file_exists (lib_buf))
{ {
if (debug) fprintf (stderr, "found: %s\n", lib_buf); if (debug) fprintf (stderr, "found: %s\n", lib_buf);
return (lib_buf); return (lib_buf);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment