Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37654905
en ru br
ALT Linux repositórios
S:0.9.27-alt4.740.g347c036
5.0: 0.9.23-alt4
4.1: 0.9.23-alt4
4.0: 0.9.23-alt4
3.0: 0.9.22-alt1

Group :: Desenvolvimento/C
RPM: tcc

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: tcc-0.9.23-linker-group_as_needed.patch
Download


diff -urN tcc-0.9.23.orig/tccelf.c tcc-0.9.23/tccelf.c
--- tcc-0.9.23.orig/tccelf.c	2005-06-18 01:09:15 +0300
+++ tcc-0.9.23/tccelf.c	2006-10-12 20:21:08 +0300
@@ -2295,10 +2295,16 @@
             return -1;
         if (!strcmp(cmd, "INPUT") ||
             !strcmp(cmd, "GROUP")) {
+#ifdef PARSE_DEBUG
+            printf("cmd is %s\n", cmd);
+#endif
             t = ld_next(s1, cmd, sizeof(cmd));
             if (t != '(')
                 expect("(");
             t = ld_next(s1, filename, sizeof(filename));
+#ifdef PARSE_DEBUG
+            printf("filename is %s\n",filename); 
+#endif
             for(;;) {
                 if (t == LD_TOK_EOF) {
                     error_noabort("unexpected end of file");
@@ -2308,12 +2314,45 @@
                 } else if (t != LD_TOK_NAME) {
                     error_noabort("filename expected");
                     return -1;
-                } 
-                tcc_add_file(s1, filename);
-                t = ld_next(s1, filename, sizeof(filename));
+                }    
+                else {
+#ifdef PARSE_DEBUG
+                    printf("Adding %s\n", filename);
+#endif
+                    tcc_add_file(s1, filename);
+                    t = ld_next(s1, filename, sizeof(filename));
+#ifdef PARSE_DEBUG
+                    printf("filename is %s \n",filename);
+#endif
+                }
+                // this line doesn't work... should be before else filename
+                // TODO: check/fix this    
                 if (t == ',') {
                     t = ld_next(s1, filename, sizeof(filename));
                 }
+                
+                // Add a hack here to fix the AS_NEEDED issue
+                // ONLY works for a single file in the AS_NEEDED list.
+                // example:     
+                //GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 )) 
+                if (!strcmp(filename, "AS_NEEDED")) {
+#ifdef PARSE_DEBUG
+                    printf("AS_NEEDED found\n");
+#endif
+                    t = ld_next(s1, cmd, sizeof(cmd));
+                    if (t != '(') expect("(");
+                    t = ld_next(s1, filename, sizeof(filename));
+#ifdef PARSE_DEBUG
+                    printf("AS_NEEDED filename is %s\n",filename); 
+                    printf("Adding %s\n", filename);
+#endif
+                    tcc_add_file(s1, filename);
+                    // get the ")" for the AS_NEEDED
+                    t = ld_next(s1, cmd, sizeof(cmd));
+                    if (t != ')') expect(")");    
+                    // get the next filename for the loop
+                    t = ld_next(s1, filename, sizeof(filename));    
+                }
             }
         } else if (!strcmp(cmd, "OUTPUT_FORMAT") ||
                    !strcmp(cmd, "TARGET")) {
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009