|
@@ -282,10 +282,6 @@ static int add_library(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int i
|
|
|
if (!s || !strlen(s))
|
|
|
return 1;
|
|
|
|
|
|
-
|
|
|
- if (strcmp(s, UCLIBC_LDSO)==0)
|
|
|
- return 1;
|
|
|
-
|
|
|
tmp = s;
|
|
|
while (*tmp) {
|
|
|
if (*tmp == '/')
|
|
@@ -293,6 +289,14 @@ static int add_library(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int i
|
|
|
tmp++;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if ((tmp=strrchr(interp, '/')) != NULL)
|
|
|
+ {
|
|
|
+ int len = strlen(interp_dir);
|
|
|
+ if (strcmp(s, interp+1+len)==0)
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
for (cur = lib_list; cur; cur=cur->next) {
|
|
|
|
|
|
tmp1 = tmp2 = cur->name;
|
|
@@ -474,42 +478,70 @@ foo:
|
|
|
|
|
|
int main( int argc, char** argv)
|
|
|
{
|
|
|
+ int multi=0;
|
|
|
int got_em_all=1;
|
|
|
- char *filename = argv[1];
|
|
|
+ char *filename = NULL;
|
|
|
struct library *cur;
|
|
|
|
|
|
-
|
|
|
- if (!filename) {
|
|
|
- fprintf(stderr, "No filename specified.\n");
|
|
|
+ if (argc < 2) {
|
|
|
+ fprintf(stderr, "ldd: missing file arguments\n");
|
|
|
+ fprintf(stderr, "Try `ldd --help' for more information.\n");
|
|
|
exit(EXIT_FAILURE);
|
|
|
}
|
|
|
+ if (argc > 2) {
|
|
|
+ multi++;
|
|
|
+ }
|
|
|
|
|
|
- find_dependancies(filename);
|
|
|
-
|
|
|
- while(got_em_all) {
|
|
|
- got_em_all=0;
|
|
|
-
|
|
|
- for (cur = lib_list; cur; cur=cur->next) {
|
|
|
- if (cur->resolved == 0 && cur->path) {
|
|
|
- got_em_all=1;
|
|
|
-
|
|
|
- find_dependancies(cur->path);
|
|
|
- cur->resolved = 1;
|
|
|
+ while (--argc > 0) {
|
|
|
+ ++argv;
|
|
|
+
|
|
|
+ if(strcmp(*argv, "--")==0) {
|
|
|
+
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(*argv, "--help")==0) {
|
|
|
+ fprintf(stderr, "Usage: ldd [OPTION]... FILE...\n");
|
|
|
+ fprintf(stderr, "\t--help\t\tprint this help and exit\n");
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
+ }
|
|
|
+
|
|
|
+ filename=*argv;
|
|
|
+ if (!filename) {
|
|
|
+ fprintf(stderr, "No filename specified.\n");
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
+ }
|
|
|
+
|
|
|
+ find_dependancies(filename);
|
|
|
+
|
|
|
+ while(got_em_all) {
|
|
|
+ got_em_all=0;
|
|
|
+
|
|
|
+ for (cur = lib_list; cur; cur=cur->next) {
|
|
|
+ if (cur->resolved == 0 && cur->path) {
|
|
|
+ got_em_all=1;
|
|
|
+
|
|
|
+ find_dependancies(cur->path);
|
|
|
+ cur->resolved = 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- got_em_all=0;
|
|
|
- for (cur = lib_list; cur; cur=cur->next) {
|
|
|
- got_em_all=1;
|
|
|
- printf("\t%s => %s\n", cur->name, cur->path);
|
|
|
+
|
|
|
+
|
|
|
+ got_em_all=0;
|
|
|
+ if (multi) {
|
|
|
+ printf("%s:\n", *argv);
|
|
|
+ }
|
|
|
+ for (cur = lib_list; cur; cur=cur->next) {
|
|
|
+ got_em_all=1;
|
|
|
+ printf("\t%s => %s\n", cur->name, cur->path);
|
|
|
+ }
|
|
|
+ if (interp_dir && got_em_all==1)
|
|
|
+ printf("\t%s => %s\n", interp, interp);
|
|
|
+ if (got_em_all==0)
|
|
|
+ printf("\tnot a dynamic executable\n");
|
|
|
}
|
|
|
- if (interp_dir && got_em_all==1)
|
|
|
- printf("\t%s => %s\n", interp, interp);
|
|
|
- if (got_em_all==0)
|
|
|
- printf("\tnot a dynamic executable\n");
|
|
|
|
|
|
return 0;
|
|
|
}
|