* ldfile.h (search_dirs_type): Move from ldfile.c, and add cmdline
field. (search_head): Declare. (ldfile_add_library_path): Add new cmdline argument in prototype. * ldfile.c (search_head): Make non-static. (search_dirs_type): Move to ldfile.h. (ldfile_add_library_path): Accept cmdline argument, and save it. * lexsup.c (parse_args): Pass true for new cmdline argument of ldfile_add_library_path. (set_default_dirlist): Likewise. * ldmain.c (check_for_scripts_dir): Pass false for new cmdline argument of ldfile_add_library_path. * ldgram.y (ifile_p1): Likewise.
This commit is contained in:
parent
ebd6f11797
commit
0cd82d00da
23
ld/ldfile.c
23
ld/ldfile.c
|
@ -40,6 +40,7 @@ char *ldfile_input_filename;
|
||||||
const char *ldfile_output_machine_name = "";
|
const char *ldfile_output_machine_name = "";
|
||||||
unsigned long ldfile_output_machine;
|
unsigned long ldfile_output_machine;
|
||||||
enum bfd_architecture ldfile_output_architecture;
|
enum bfd_architecture ldfile_output_architecture;
|
||||||
|
search_dirs_type *search_head;
|
||||||
|
|
||||||
/* start-sanitize-mpw */
|
/* start-sanitize-mpw */
|
||||||
#ifndef MPW
|
#ifndef MPW
|
||||||
|
@ -56,17 +57,8 @@ char *slash = ":";
|
||||||
#endif /* MPW */
|
#endif /* MPW */
|
||||||
/* end-sanitize-mpw */
|
/* end-sanitize-mpw */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* LOCAL */
|
/* LOCAL */
|
||||||
typedef struct search_dirs
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
struct search_dirs *next;
|
|
||||||
} search_dirs_type;
|
|
||||||
|
|
||||||
static search_dirs_type *search_head;
|
|
||||||
static search_dirs_type **search_tail_ptr = &search_head;
|
static search_dirs_type **search_tail_ptr = &search_head;
|
||||||
|
|
||||||
typedef struct search_arch
|
typedef struct search_arch
|
||||||
|
@ -85,13 +77,16 @@ static bfd *open_a PARAMS ((char *arch, lang_input_statement_type *entry,
|
||||||
static FILE *try_open PARAMS ((char *name, char *exten));
|
static FILE *try_open PARAMS ((char *name, char *exten));
|
||||||
|
|
||||||
void
|
void
|
||||||
ldfile_add_library_path(name)
|
ldfile_add_library_path (name, cmdline)
|
||||||
char *name;
|
const char *name;
|
||||||
|
boolean cmdline;
|
||||||
{
|
{
|
||||||
search_dirs_type *new =
|
search_dirs_type *new;
|
||||||
(search_dirs_type *)xmalloc((bfd_size_type)(sizeof(search_dirs_type)));
|
|
||||||
|
new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type));
|
||||||
|
new->next = NULL;
|
||||||
new->name = name;
|
new->name = name;
|
||||||
new->next = (search_dirs_type*)NULL;
|
new->cmdline = cmdline;
|
||||||
*search_tail_ptr = new;
|
*search_tail_ptr = new;
|
||||||
search_tail_ptr = &new->next;
|
search_tail_ptr = &new->next;
|
||||||
}
|
}
|
||||||
|
|
33
ld/ldfile.h
33
ld/ldfile.h
|
@ -1,6 +1,5 @@
|
||||||
/* ldfile.h -
|
/* ldfile.h -
|
||||||
|
Copyright 1991, 1992 Free Software Foundation, Inc.
|
||||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
|
|
||||||
|
@ -18,10 +17,30 @@
|
||||||
along with GLD; see the file COPYING. If not, write to
|
along with GLD; see the file COPYING. If not, write to
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
extern char *ldfile_input_filename;
|
||||||
|
extern unsigned long ldfile_output_machine;
|
||||||
|
extern enum bfd_architecture ldfile_output_architecture;
|
||||||
|
extern const char *ldfile_output_machine_name;
|
||||||
|
|
||||||
PROTO(void,ldfile_add_arch,(CONST char *CONST));
|
/* Structure used to hold the list of directories to search for
|
||||||
PROTO(void,ldfile_add_library_path,(char *));
|
libraries. */
|
||||||
PROTO(void,ldfile_open_command_file,(char *name));
|
|
||||||
PROTO(void,ldfile_open_file,(struct lang_input_statement_struct *));
|
|
||||||
|
|
||||||
|
typedef struct search_dirs
|
||||||
|
{
|
||||||
|
/* Next directory on list. */
|
||||||
|
struct search_dirs *next;
|
||||||
|
/* Name of directory. */
|
||||||
|
const char *name;
|
||||||
|
/* true if this is from the command line. */
|
||||||
|
boolean cmdline;
|
||||||
|
} search_dirs_type;
|
||||||
|
|
||||||
|
extern search_dirs_type *search_head;
|
||||||
|
|
||||||
|
void ldfile_add_arch PARAMS ((CONST char *));
|
||||||
|
void ldfile_add_library_path PARAMS ((const char *, boolean cmdline));
|
||||||
|
void ldfile_open_command_file PARAMS ((char *name));
|
||||||
|
void ldfile_open_file PARAMS ((struct lang_input_statement_struct *));
|
||||||
|
FILE *ldfile_find_command_file PARAMS ((char *name, char *extend));
|
||||||
|
|
||||||
|
void ldfile_set_output_arch PARAMS ((CONST char *));
|
||||||
|
|
|
@ -241,7 +241,7 @@ ifile_p1:
|
||||||
| TARGET_K '(' NAME ')'
|
| TARGET_K '(' NAME ')'
|
||||||
{ lang_add_target($3); }
|
{ lang_add_target($3); }
|
||||||
| SEARCH_DIR '(' filename ')'
|
| SEARCH_DIR '(' filename ')'
|
||||||
{ ldfile_add_library_path($3); }
|
{ ldfile_add_library_path ($3, false); }
|
||||||
| OUTPUT '(' filename ')'
|
| OUTPUT '(' filename ')'
|
||||||
{ lang_add_output($3, 1); }
|
{ lang_add_output($3, 1); }
|
||||||
| OUTPUT_FORMAT '(' NAME ')'
|
| OUTPUT_FORMAT '(' NAME ')'
|
||||||
|
|
|
@ -397,7 +397,7 @@ check_for_scripts_dir (dir)
|
||||||
res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
|
res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
|
||||||
free (buf);
|
free (buf);
|
||||||
if (res)
|
if (res)
|
||||||
ldfile_add_library_path (dir);
|
ldfile_add_library_path (dir, false);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ parse_args (argc, argv)
|
||||||
xexit (0);
|
xexit (0);
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
ldfile_add_library_path (optarg);
|
ldfile_add_library_path (optarg, true);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
lang_add_input_file (optarg, lang_input_file_is_l_enum,
|
lang_add_input_file (optarg, lang_input_file_is_l_enum,
|
||||||
|
@ -335,7 +335,7 @@ set_default_dirlist (dirlist_ptr)
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if (*dirlist_ptr)
|
if (*dirlist_ptr)
|
||||||
ldfile_add_library_path (dirlist_ptr);
|
ldfile_add_library_path (dirlist_ptr, true);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
break;
|
break;
|
||||||
*p = ':';
|
*p = ':';
|
||||||
|
|
Loading…
Reference in New Issue