* 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:
Ian Lance Taylor 1994-06-02 21:30:57 +00:00
parent ebd6f11797
commit 0cd82d00da
5 changed files with 39 additions and 25 deletions

View File

@ -40,6 +40,7 @@ char *ldfile_input_filename;
const char *ldfile_output_machine_name = "";
unsigned long ldfile_output_machine;
enum bfd_architecture ldfile_output_architecture;
search_dirs_type *search_head;
/* start-sanitize-mpw */
#ifndef MPW
@ -56,17 +57,8 @@ char *slash = ":";
#endif /* MPW */
/* end-sanitize-mpw */
/* 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;
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));
void
ldfile_add_library_path(name)
char *name;
ldfile_add_library_path (name, cmdline)
const char *name;
boolean cmdline;
{
search_dirs_type *new =
(search_dirs_type *)xmalloc((bfd_size_type)(sizeof(search_dirs_type)));
search_dirs_type *new;
new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type));
new->next = NULL;
new->name = name;
new->next = (search_dirs_type*)NULL;
new->cmdline = cmdline;
*search_tail_ptr = new;
search_tail_ptr = &new->next;
}

View File

@ -1,6 +1,5 @@
/* ldfile.h -
Copyright (C) 1991 Free Software Foundation, Inc.
Copyright 1991, 1992 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@ -18,10 +17,30 @@
along with GLD; see the file COPYING. If not, write to
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));
PROTO(void,ldfile_add_library_path,(char *));
PROTO(void,ldfile_open_command_file,(char *name));
PROTO(void,ldfile_open_file,(struct lang_input_statement_struct *));
/* Structure used to hold the list of directories to search for
libraries. */
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 *));

View File

@ -241,7 +241,7 @@ ifile_p1:
| TARGET_K '(' NAME ')'
{ lang_add_target($3); }
| SEARCH_DIR '(' filename ')'
{ ldfile_add_library_path($3); }
{ ldfile_add_library_path ($3, false); }
| OUTPUT '(' filename ')'
{ lang_add_output($3, 1); }
| OUTPUT_FORMAT '(' NAME ')'

View File

@ -397,7 +397,7 @@ check_for_scripts_dir (dir)
res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
free (buf);
if (res)
ldfile_add_library_path (dir);
ldfile_add_library_path (dir, false);
return res;
}

View File

@ -189,7 +189,7 @@ parse_args (argc, argv)
xexit (0);
break;
case 'L':
ldfile_add_library_path (optarg);
ldfile_add_library_path (optarg, true);
break;
case 'l':
lang_add_input_file (optarg, lang_input_file_is_l_enum,
@ -335,7 +335,7 @@ set_default_dirlist (dirlist_ptr)
if (p != NULL)
*p = 0;
if (*dirlist_ptr)
ldfile_add_library_path (dirlist_ptr);
ldfile_add_library_path (dirlist_ptr, true);
if (p == NULL)
break;
*p = ':';