libtool
[Top][All Lists]
Advanced

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

Re: adapting for use with TCC


From: Ralf Wildenhues
Subject: Re: adapting for use with TCC
Date: Thu, 29 Dec 2005 14:46:14 +0100
User-agent: Mutt/1.5.11

Hi Edward,

* Edward Chernenko wrote on Wed, Dec 28, 2005 at 12:34:06PM CET:
> Hi, my system is LFS/Linux, C compiler TCC 0.9.23 and
> I'm using
> > GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
> 
> This compiler have no support for '-soname' linker
> option. I advise you to include the check for such a
> compiler feature into the libtool configure macro.

Thanks for reporting this.  I've looked at TCC/linux a bit, and I have a
patch to add *very basic* support for TCC/linux to CVS HEAD Libtool.
tcc does not pass flags it does not know through to the linker (even
with `-Wl,'), or does not even invoke an external linker, and it does
not know very many linker flags at all.  For example, it does not allow
hardcoding of paths in any way; to quote a comment in ltmain.sh:
       # Here we assume that one of hardcode_direct or hardcode_minus_L
       # is not unsupported.  This is valid on all known static and
       # shared platforms.

Hrmpf.

So, if I fake `hardcode_direct=yes' and `shlibpath_overrides_runpath=yes'
in the libtool script together with the patch below, I can get the
depdemo test to at least finish compiling, and the wrapper to cause all
libraries to be found.  The resulting binaries immediately dump core,
though.  So I wonder whether TCC support for shared libraries is maybe a
bit premature.  I also wonder whether it's a good idea to divert so much
from GNU ld behavior on a GNU system -- not being able to set a soname
is quite unfortunate, and not generating PIC code at all seems like a
bad idea to me, too -- but that is for the TCC authors to decide.
(all tests done on x86_64 in 32bit mode, TCC 0.9.23).

All in all, I wonder whether it's better to wait for TCC to improve or
to try to bend libtool to accomodate for TCC limitations.

Interestingly, tcc uncovered unportable use of parentheses around string
literal initializers (see fix in another post, to libtool-patches).

Cheers,
Ralf

        * libltdl/m4/libtool.m4 (_LT_COMPILER_PIC, _LT_LINKER_SHLIBS)
        [ linux ] <tcc>: Initial support for TCC (Tiny C Compiler).
        * NEWS: Updated.

Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.190
diff -u -r1.190 NEWS
--- NEWS        3 Dec 2005 08:48:14 -0000       1.190
+++ NEWS        29 Dec 2005 13:26:40 -0000
@@ -30,6 +30,7 @@
   statically with `-static'.
 * Support for Interix 3 (Windows SFU).
 * Basic support for PIE (position-independent executables).
+* Very basic support for TCC on GNU/Linux.
 * Bug fixes.
 
 New in 1.9f: 2004-10-23; CVS version 1.9e, Libtool team:
Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.54
diff -u -r1.54 libtool.m4
--- libltdl/m4/libtool.m4       18 Dec 2005 13:09:45 -0000      1.54
+++ libltdl/m4/libtool.m4       29 Dec 2005 10:11:06 -0000
@@ -3764,6 +3764,10 @@
         # All Alpha code is PIC.
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
+      tcc*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+       ;;
       esac
       ;;
 
@@ -4092,6 +4096,7 @@
         && test "$tmp_diet" = no
       then
        tmp_addflag=
+       tmp_sonameflag='${wl}-soname $wl$soname'
        case $cc_basename,$host_cpu in
         pgcc*)                         # Portland Group C compiler
          _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for 
conv in $convenience\"\"; do test  -n \"$conv\" && 
new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` 
${wl}--no-whole-archive'
@@ -4106,12 +4111,18 @@
          tmp_addflag=' -i_dynamic -nofor_main' ;;
        ifc* | ifort*)                  # Intel Fortran compiler
          tmp_addflag=' -nofor_main' ;;
+       tcc*)                           # Tiny C Compiler
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+         _LT_TAGVAR(whole_archive_flag_spec, $1)=
+         tmp_sonameflag=
+         supports_anon_versioning=no ;;
        esac
 
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs 
$deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs 
$deplibs $compiler_flags '"$tmp_sonameflag"' -o $lib'
 
         if test "x$supports_anon_versioning" = xyes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > 
$output_objdir/$libname.ver~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> 
$output_objdir/$libname.ver~echo "local: *; };" >> 
$output_objdir/$libname.ver~$CC -shared'"$tmp_addflag"' $libobjs $deplibs 
$compiler_flags ${wl}-soname $wl$soname ${wl}-version-script 
${wl}$output_objdir/$libname.ver -o $lib'
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > 
$output_objdir/$libname.ver~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> 
$output_objdir/$libname.ver~echo "local: *; };" >> 
$output_objdir/$libname.ver~$CC -shared'"$tmp_addflag"' $libobjs $deplibs 
$compiler_flags '"$tmp_sonameflag"' ${wl}-version-script 
${wl}$output_objdir/$libname.ver -o $lib'
         fi
       else
         _LT_TAGVAR(ld_shlibs, $1)=no




reply via email to

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