mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
* emultempl/sunos.em: Include <ctype.h>.
(gld${EMULATION_NAME}_find_so): Skip the directory name when searching for ".so.". (gld${EMULATION_NAME}_search_dir): Make sure that the library name has a version number, and that only version numbers follow .so.
This commit is contained in:
parent
0fc327a3fb
commit
e87b950c8e
@ -1,3 +1,11 @@
|
||||
Thu Jan 30 11:31:52 1997 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* emultempl/sunos.em: Include <ctype.h>.
|
||||
(gld${EMULATION_NAME}_find_so): Skip the directory name when
|
||||
searching for ".so.".
|
||||
(gld${EMULATION_NAME}_search_dir): Make sure that the library name
|
||||
has a version number, and that only version numbers follow .so.
|
||||
|
||||
Wed Jan 29 18:15:00 1997 Geoffrey Noer <noer@cygnus.com>
|
||||
|
||||
* scripttempl/pe.sc:
|
||||
|
@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
|
||||
/* This file is is generated by a shell script. DO NOT EDIT! */
|
||||
|
||||
/* SunOS emulation code for ${EMULATION_NAME}
|
||||
Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain <sac@cygnus.com>
|
||||
SunOS shared library support by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
@ -26,12 +26,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_${EMULATION_NAME}
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "bfdlink.h"
|
||||
#include "libiberty.h"
|
||||
|
||||
#include "ld.h"
|
||||
#include "ldmain.h"
|
||||
@ -57,6 +59,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#endif
|
||||
|
||||
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
|
||||
static void gld${EMULATION_NAME}_set_symbols PARAMS ((void));
|
||||
static void gld${EMULATION_NAME}_create_output_section_statements
|
||||
PARAMS ((void));
|
||||
static void gld${EMULATION_NAME}_find_so
|
||||
@ -87,6 +90,46 @@ gld${EMULATION_NAME}_before_parse()
|
||||
config.dynamic_link = true;
|
||||
}
|
||||
|
||||
/* This is called after the command line arguments have been parsed,
|
||||
but before the linker script has been read. If this is a native
|
||||
linker, we add the directories in LD_LIBRARY_PATH to the search
|
||||
list. */
|
||||
|
||||
static void
|
||||
gld${EMULATION_NAME}_set_symbols ()
|
||||
{
|
||||
EOF
|
||||
if [ "x${host}" = "x${target}" ] ; then
|
||||
if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
const char *env;
|
||||
|
||||
env = (const char *) getenv ("LD_LIBRARY_PATH");
|
||||
if (env != NULL)
|
||||
{
|
||||
char *l;
|
||||
|
||||
l = xstrdup (env);
|
||||
while (1)
|
||||
{
|
||||
char *c;
|
||||
|
||||
c = strchr (l, ':');
|
||||
if (c != NULL)
|
||||
*c++ = '\0';
|
||||
if (*l != '\0')
|
||||
ldfile_add_library_path (l, false);
|
||||
if (c == NULL)
|
||||
break;
|
||||
l = c;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
}
|
||||
|
||||
/* Despite the name, we use this routine to search for dynamic
|
||||
libraries. On SunOS this requires a directory search. We need to
|
||||
find the .so file with the highest version number. The user may
|
||||
@ -153,36 +196,22 @@ gld${EMULATION_NAME}_find_so (inp)
|
||||
found, add it to the list of input files. */
|
||||
alc = (char *) xmalloc (strlen (inp->filename) + 1);
|
||||
strcpy (alc, inp->filename);
|
||||
strstr (alc, ".so.")[2] = 'a';
|
||||
if (stat (alc, &st) == 0)
|
||||
strstr (alc + strlen (search->name), ".so.")[2] = 'a';
|
||||
if (stat (alc, &st) != 0)
|
||||
free (alc);
|
||||
else
|
||||
{
|
||||
lang_input_statement_type *sa;
|
||||
char *a;
|
||||
|
||||
/* Add the .sa file to the statement list just after the .so
|
||||
/* Add the .sa file to the statement list just before the .so
|
||||
file. This is really a hack. */
|
||||
sa = ((lang_input_statement_type *)
|
||||
xmalloc (sizeof (lang_input_statement_type)));
|
||||
sa->header.next = inp->header.next;
|
||||
sa->header.type = lang_input_statement_enum;
|
||||
a = (char *) xmalloc (strlen (alc) + 1);
|
||||
strcpy (a, alc);
|
||||
sa->filename = a;
|
||||
sa->local_sym_name = a;
|
||||
sa->the_bfd = NULL;
|
||||
sa->asymbols = NULL;
|
||||
sa->symbol_count = 0;
|
||||
sa->next = NULL;
|
||||
sa->next_real_file = inp->next_real_file;
|
||||
sa->is_archive = false;
|
||||
sa->search_dirs_flag = false;
|
||||
sa->just_syms_flag = false;
|
||||
sa->loaded = false;
|
||||
sa->real = true;
|
||||
sa->complained = false;
|
||||
*sa = *inp;
|
||||
|
||||
inp->filename = alc;
|
||||
inp->local_sym_name = alc;
|
||||
|
||||
/* Put the new statement next on the list of statements and next
|
||||
on the list of input files. */
|
||||
inp->header.next = (lang_statement_union_type *) sa;
|
||||
inp->next_real_file = (lang_statement_union_type *) sa;
|
||||
}
|
||||
@ -239,6 +268,7 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static)
|
||||
|
||||
while ((entry = readdir (dir)) != NULL)
|
||||
{
|
||||
const char *s;
|
||||
int found_maj, found_min;
|
||||
|
||||
if (strncmp (entry->d_name, "lib", 3) != 0
|
||||
@ -252,7 +282,14 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0)
|
||||
if (strncmp (entry->d_name + 3 + len, ".so.", 4) != 0
|
||||
|| ! isdigit (entry->d_name[7 + len]))
|
||||
continue;
|
||||
|
||||
for (s = entry->d_name + 7 + len; *s != '\0'; s++)
|
||||
if (*s != '.' && ! isdigit (*s))
|
||||
break;
|
||||
if (*s != '\0')
|
||||
continue;
|
||||
|
||||
/* We've found a .so file. Work out the major and minor
|
||||
@ -325,7 +362,6 @@ gld${EMULATION_NAME}_after_open ()
|
||||
{
|
||||
struct bfd_link_needed_list *ll;
|
||||
const char *lname;
|
||||
const char *lib_path;
|
||||
search_dirs_type *search;
|
||||
|
||||
lname = l->name;
|
||||
@ -404,12 +440,18 @@ gld${EMULATION_NAME}_after_open ()
|
||||
continue;
|
||||
}
|
||||
EOF
|
||||
if [ "x${host_alias}" = "x${target_alias}" ] ; then
|
||||
if [ "x${host}" = "x${target}" ] ; then
|
||||
if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
|
||||
if (gld${EMULATION_NAME}_search_needed (lib_path, lname))
|
||||
continue;
|
||||
{
|
||||
const char *lib_path;
|
||||
|
||||
lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
|
||||
if (gld${EMULATION_NAME}_search_needed (lib_path, lname))
|
||||
continue;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
if (command_line.rpath != NULL)
|
||||
@ -965,6 +1007,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
"${OUTPUT_FORMAT}",
|
||||
NULL, /* finish */
|
||||
gld${EMULATION_NAME}_create_output_section_statements,
|
||||
NULL /* open_dynamic_library */
|
||||
NULL, /* open_dynamic_library */
|
||||
NULL, /* place_orphan */
|
||||
gld${EMULATION_NAME}_set_symbols
|
||||
};
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user