diff options
author | jdp <jdp@FreeBSD.org> | 1997-03-22 02:59:40 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1997-03-22 02:59:40 +0000 |
commit | d25562909d350a2ede1af20506d2de39eadcbf30 (patch) | |
tree | 189a27ba9162d94cc71bbf2b95f57b54654b2b5e /gnu/usr.bin/ld/ld.c | |
parent | d8c04b9e65f2099cdf0b93b956dab18f7c4ae6eb (diff) | |
download | FreeBSD-src-d25562909d350a2ede1af20506d2de39eadcbf30.zip FreeBSD-src-d25562909d350a2ede1af20506d2de39eadcbf30.tar.gz |
Add a new "-f" option to the linker, to print the resolved paths
of all the files and libraries in the command line.
Submitted by: bde (Bruce Evans)
Diffstat (limited to 'gnu/usr.bin/ld/ld.c')
-rw-r--r-- | gnu/usr.bin/ld/ld.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c index 9f8f94b..fb2baac 100644 --- a/gnu/usr.bin/ld/ld.c +++ b/gnu/usr.bin/ld/ld.c @@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c 6.10 (Berkeley) 5/22/91"; Set, indirect, and warning symbol features added by Randy Smith. */ /* - * $Id$ + * $Id: ld.c,v 1.41 1997/02/22 15:46:20 peter Exp $ */ /* Define how to initialize system-dependent header fields. */ @@ -200,6 +200,7 @@ int global_alias_count; /* # of aliased symbols */ int set_symbol_count; /* # of N_SET* symbols. */ int set_vector_count; /* # of set vectors in output. */ int warn_sym_count; /* # of warning symbols encountered. */ +int flag_list_files; /* 1 => print pathnames of files, don't link */ int list_warning_symbols; /* 1 => warning symbols referenced */ struct string_list_element *set_element_prefixes; @@ -263,6 +264,7 @@ static void write_syms __P((void)); static void assign_symbolnums __P((struct file_entry *, int *)); static void cleanup __P((void)); static int parse __P((char *, char *, char *)); +static void list_files __P((void)); int @@ -344,6 +346,9 @@ main(argc, argv) /* Completely decode ARGV. */ decode_command(argc, argv); + if (flag_list_files) + list_files(); + building_shared_object = (!relocatable_output && (link_mode & SHAREABLE)); @@ -684,6 +689,10 @@ decode_option(swt, arg) add_cmdline_ref(entry_symbol); return; + case 'f': + flag_list_files = 1; + return; + case 'l': return; @@ -3770,3 +3779,26 @@ padfile(padding, fd) bzero(buf, padding); mywrite(buf, padding, 1, fd); } + +static void +list_files() +{ + int error, i; + + error = 0; + for (i = 0; i < number_of_files; i++) { + register struct file_entry *entry = &file_table[i]; + int fd; + + if (entry->flags & E_SEARCH_DIRS) + fd = findlib(entry); + else + fd = open(entry->filename, O_RDONLY, 0); + if (fd < 0) + error = 1; + else + close(fd); + printf("%s\n", entry->filename); + } + exit(error); +} |