History

ignore AS_NEEDED ld command

bellard committed 21 years ago

Commit bb24eb91 parent 44738b51 file · +40 −21Browse files

Unified · Split

tccelf.c+40−21
@@ -2277,13 +2277,49 @@ static int ld_next(TCCState *s1, char *name, int name_size) · 2276 unmodified lines
2277 return c;2277 return c;
2278}2278}
2279 2279
2280static int ld_add_file_list(TCCState *s1, int as_needed)
2281{
2282 char filename[1024];
2283 int t, ret;
2284
2285 t = ld_next(s1, filename, sizeof(filename));
2286 if (t != '(')
2287 expect("(");
2288 t = ld_next(s1, filename, sizeof(filename));
2289 for(;;) {
2290 if (t == LD_TOK_EOF) {
2291 error_noabort("unexpected end of file");
2292 return -1;
2293 } else if (t == ')') {
2294 break;
2295 } else if (t != LD_TOK_NAME) {
2296 error_noabort("filename expected");
2297 return -1;
2298 }
2299 if (!strcmp(filename, "AS_NEEDED")) {
2300 ret = ld_add_file_list(s1, 1);
2301 if (ret)
2302 return ret;
2303 } else {
2304 /* TODO: Implement AS_NEEDED support. Ignore it for now */
2305 if (!as_needed)
2306 tcc_add_file(s1, filename);
2307 }
2308 t = ld_next(s1, filename, sizeof(filename));
2309 if (t == ',') {
2310 t = ld_next(s1, filename, sizeof(filename));
2311 }
2312 }
2313 return 0;
2314}
2315
2280/* interpret a subset of GNU ldscripts to handle the dummy libc.so2316/* interpret a subset of GNU ldscripts to handle the dummy libc.so
2281 files */2317 files */
2282static int tcc_load_ldscript(TCCState *s1)2318static int tcc_load_ldscript(TCCState *s1)
2283{2319{
2284 char cmd[64];2320 char cmd[64];
2285 char filename[1024];2321 char filename[1024];
2286 int t;2322 int t, ret;
2287 2323
2288 ch = file->buf_ptr[0];2324 ch = file->buf_ptr[0];
2289 ch = handle_eob();2325 ch = handle_eob();
@@ -2295,26 +2331,9 @@ static int tcc_load_ldscript(TCCState *s1) · 5 unmodified lines
2295 return -1;2331 return -1;
2296 if (!strcmp(cmd, "INPUT") ||2332 if (!strcmp(cmd, "INPUT") ||
2297 !strcmp(cmd, "GROUP")) {2333 !strcmp(cmd, "GROUP")) {
2298 t = ld_next(s1, cmd, sizeof(cmd));2334 ret = ld_add_file_list(s1, 0);
2299 if (t != '(')2335 if (ret)
2300 expect("(");2336 return ret;
2301 t = ld_next(s1, filename, sizeof(filename));
2302 for(;;) {
2303 if (t == LD_TOK_EOF) {
2304 error_noabort("unexpected end of file");
2305 return -1;
2306 } else if (t == ')') {
2307 break;
2308 } else if (t != LD_TOK_NAME) {
2309 error_noabort("filename expected");
2310 return -1;
2311 }
2312 tcc_add_file(s1, filename);
2313 t = ld_next(s1, filename, sizeof(filename));
2314 if (t == ',') {
2315 t = ld_next(s1, filename, sizeof(filename));
2316 }
2317 }
2318 } else if (!strcmp(cmd, "OUTPUT_FORMAT") ||2337 } else if (!strcmp(cmd, "OUTPUT_FORMAT") ||
2319 !strcmp(cmd, "TARGET")) {2338 !strcmp(cmd, "TARGET")) {
2320 /* ignore some commands */2339 /* ignore some commands */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t