The following patch is a quick and dirty hack to allow tcc to run in an
environment where the load scripts have the keyword AS_NEEDED, as
reported here:
http://lists.nongnu.org/archive/html/tinycc-devel/2005-08/msg00002.html.
The resulting code ignores everything inside the AS_NEEDED( ). This is
meant to be a temporary solution while the support for this keyword is
not implemented.
By the way, what is the accepted form of submitting patches in this
project? In the mean time, while you do not answer, I am putting it
both in the e-mail body and as an attachment.
Cheers!
Marcelo.
Index: tccelf.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/tccelf.c,v
retrieving revision 1.30
diff -u -r1.30 tccelf.c
--- tccelf.c 17 Apr 2005 13:15:54 -0000 1.30
+++ tccelf.c 29 Aug 2005 00:56:27 -0000
@@ -2300,19 +2300,27 @@
expect("(");
t = ld_next(s1, filename, sizeof(filename));
for(;;) {
- if (t == LD_TOK_EOF) {
-
error_noabort("unexpected end of file");
- return -1;
- } else if (t == ')') {
- break;
- } else if (t != LD_TOK_NAME) {
-
error_noabort("filename expected");
- return -1;
- }
- tcc_add_file(s1, filename);
-
t = ld_next(s1, filename, sizeof(filename));
- if (t == ',') {
+ if (strcmp(filename, "AS_NEEDED")) {
+ if (t == LD_TOK_EOF) {
+ error_noabort("unexpected end of file");
+
return -1;
+ } else if (t == ')') {
+ break;
+ } else if (t != LD_TOK_NAME) {
+ error_noabort("filename expected");
+ return -1;
+ }
+
tcc_add_file(s1, filename);
t = ld_next(s1, filename, sizeof(filename));
+
if (t == ',') {
+
t = ld_next(s1, filename, sizeof(filename));
+ }
+ } else {
+
/* TODO: Implement AS_NEEDED support. Ignore it for now */
+ do {
+
t = ld_next(s1, filename, sizeof(cmd));
+
} while (t != ')');
+
t = ld_next(s1, filename, sizeof(cmd));
}
}
} else if (!strcmp(cmd, "OUTPUT_FORMAT") ||