From: Ian Lance Taylor Date: Thu, 2 Jun 1994 21:30:57 +0000 (+0000) Subject: * ldfile.h (search_dirs_type): Move from ldfile.c, and add cmdline X-Git-Tag: gdb-4_18~14425 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cd82d00da11d624087fada13fc68db95b4d5e63;p=external%2Fbinutils.git * 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. --- diff --git a/ld/ldfile.c b/ld/ldfile.c index 34b142c..5cc3bef 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -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; } diff --git a/ld/ldfile.h b/ld/ldfile.h index f4ad289..f351f6f 100644 --- a/ld/ldfile.h +++ b/ld/ldfile.h @@ -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. */ - - -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 *)); - +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; + +/* 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 *)); diff --git a/ld/ldgram.y b/ld/ldgram.y index 4789b7c..9044355 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -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 ')' diff --git a/ld/ldmain.c b/ld/ldmain.c index ae64b23..3109bbb 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -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; } diff --git a/ld/lexsup.c b/ld/lexsup.c index 058f546..bf2365c 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -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 = ':';