comparison lwlink/readfiles.c @ 179:606123758641

Added --sysroot support to lwlink and the ld wrapper script
author lost@l-w.ca
date Thu, 15 Sep 2011 17:08:16 -0600
parents fc8386b13399
children ce1fdc8d6568
comparison
equal deleted inserted replaced
178:35f7ce3ef857 179:606123758641
75 75
76 f = NULL; 76 f = NULL;
77 77
78 for (j = 0; j < nlibdirs; j++) 78 for (j = 0; j < nlibdirs; j++)
79 { 79 {
80 s = strlen(libdirs[j]) + 7 + strlen(inputfiles[i] -> filename); 80 if (libdirs[j][0] == '=')
81 tf = lw_alloc(s + 1); 81 {
82 sprintf(tf, "%s/lib%s.a", libdirs[j], inputfiles[i] -> filename); 82 // handle sysroot
83 s = strlen(libdirs[j]) + 7 + strlen(sysroot) + strlen(inputfiles[i] -> filename);
84 tf = lw_alloc(s + 1);
85 sprintf(tf, "%s/%s/lib%s.a", sysroot, libdirs[j] + 1, inputfiles[i] -> filename);
86 }
87 else
88 {
89 s = strlen(libdirs[j]) + 7 + strlen(inputfiles[i] -> filename);
90 tf = lw_alloc(s + 1);
91 sprintf(tf, "%s/lib%s.a", libdirs[j], inputfiles[i] -> filename);
92 }
83 f = fopen(tf, "rb"); 93 f = fopen(tf, "rb");
84 if (!f) 94 if (!f)
85 { 95 {
86 free(tf); 96 free(tf);
87 continue; 97 continue;