tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc on fc4 ?


From: Kim Lux
Subject: Re: [Tinycc-devel] tcc on fc4 ?
Date: Thu, 15 Dec 2005 10:56:20 -0700

Here is what Redhat says:

=======================================================
That's tcc's fault, not glibc.  libc.so is a linker script (and has been
for
many years), so if tcc for some weirdo reason uses its own linker and
doesn't
grok it or looks at it for whatever other reason, it is just its fault
and should be fixed there.
======================================================

Daniel Stasinski wrote this on Aug. 4, 2005, about the same problem:

=====================================================
The problem I mentioned yesterday comes from tcc not being able to parse
nested () in ld scripts. The new version of /usr/lib/libc.so looks like
this: 
/* GNU ld script 
Use the shared library, but some functions are only in 
the static library, so try that secondarily. */ 
OUTPUT_FORMAT(elf32-i386) 
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED
( /lib/ld-linux.so.2 ) ) 

The old version looks like this: 
/* GNU ld script 
Use the shared library, but some functions are only 
in the static library, so try that secondarily. */ 
OUTPUT_FORMAT(elf32-i386) 
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a ) 

"AS_NEEDED" is a new feature since binutils 2.16.
=====================================================

I am running binutils 2.15.94.

In tccelf.c.2292 I changed the routine to this:

==========================================================
if (!strcmp(cmd, "INPUT") ||
            !strcmp(cmd, "GROUP")) {
            printf("cmd is %s\n", cmd); //I added
            t = ld_next(s1, cmd, sizeof(cmd));
            if (t != '(')
                expect("(");
            t = ld_next(s1, filename, sizeof(filename));
            printf("filename is %s\n",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;
                }    
                else{
                        printf("Adding %s\n", filename);
                        tcc_add_file(s1, filename);
                        }
                        t = ld_next(s1, filename, sizeof(filename));
                        printf("filename is %s \n",filename); 
                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"))
                        {
                        printf("AS_NEEDED found\n");
                        // get the "(" for the AS_NEEDED
                        t = ld_next(s1, cmd, sizeof(cmd));
                        if (t != '(')
                                expect("(");
                        //get the real filename
                        t = ld_next(s1, filename, sizeof(filename));    
                        printf("AS_NEEDED filename is %s\n",filename); 
                        printf("Adding %s\n", filename);
                        tcc_add_file(s1, filename);
                        // get the ")" for the AS_NEEDED
                        t = ld_next(s1, cmd, sizeof(cmd));
                        if (t != ')')
                                expect(")");    
                        }// if AS_NEEDED
===========================================================

This appears to fix the AS_NEEDED issue.  Now my output looks like this:

cmd is GROUP
filename is /lib/libc.so.6
Adding /lib/libc.so.6
filename is /usr/lib/libc_nonshared.a 
Adding /usr/lib/libc_nonshared.a
filename is AS_NEEDED 
AS_NEEDED found
AS_NEEDED filename is /lib/ld-linux.so.2
/usr/lib/libc.so:3: unrecognized file type
Adding /lib/ld-linux.so.2
/usr/lib/libc.a: '_dl_tls_static_size' defined twice
tcc: undefined symbol '_Unwind_Resume'
tcc: undefined symbol '__gcc_personality_v0'
tcc: undefined symbol '_Unwind_GetIP'
tcc: undefined symbol '_Unwind_GetGR'
tcc: undefined symbol '_Unwind_GetCFA'
tcc: undefined symbol '_Unwind_Backtrace'


What is up with the unrecognized file type ?









-- 
Kim Lux,  Diesel Research Inc.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]