Menu

#112 CIL does not use all the linking flags

closed-fixed
5
2011-10-28
2009-08-04
Anonymous
No

CIL does not use all the linking flags

It seems that CIL 1.3.7 gets confused when a program passes something
like -Wl,--export-dynamic, while CIL 1.3.6 did not show this problem.

I'm attaching a testcase that demonstrates this. Although we issue:

cilly -o test_main_merged_last -Wl,--export-dynamic
test_main_merged_last_main.c test_main_merged_last_lib.c

eventually CIL issues:

gcc -D_GNUCC -o
test_main_merged_last /tmp/cil-gjDUCj1W.o /tmp/cil-LuCLI4nH.o
--export-dynamic

So, it misses passing the complete "-Wl,--export-dynamic". It only
passed "--export-dynamic"

This seems to have been introduced in r9420.

$ svn diff -r9419:9420 Cilly.pm
Index: Cilly.pm
===================================================================
--- Cilly.pm (revision 9419)
+++ Cilly.pm (revision 9420)
@@ -1992,7 +1992,12 @@
"-static-libgcc" => { TYPE => 'LINK' },
"-shared-libgcc" => { TYPE => 'LINK' },
'-Wl,--(no-)?whole-archive$' => { TYPE => 'OSOURCE' },
- '-Wl,' => { TYPE => 'LINK' },
+ '-Wl,' =>
+ { RUN => sub {
+ my ($linkargs) = ($_[1] =~ m|-Wl,(.*)$|);
+ #Split up the args
+ push @{$stub->{LINKARGS}}, split(/,/, $linkargs);
+ }},
"-traditional" => { TYPE => 'PREPROC' },
'-std=' => { TYPE => 'ALLARGS' },
"--start-group" => { RUN => sub { } },

------------------------------------------------------------------------
r9420 | matth | 2007-03-06 13:18:20 -0700 (Tue, 06 Mar 2007) | 1 line

fix the handling of -Wl, and suppress some int truncation warnings

Discussion

  • Nobody/Anonymous

    Test case showing the problem with -Wl,--export-dynamic

     
  • Gabriel Kerneis

    Gabriel Kerneis - 2011-09-22
    • assigned_to: nobody --> kerneis
    • status: open --> open-accepted
     
  • Gabriel Kerneis

    Gabriel Kerneis - 2011-10-28

    Thanks for the support. This is fixed in latest git.

    commit 5276d40aa6d29435bb67c4357840a1e4ae70a905
    Author: Gabriel Kerneis <kerneis@pps.jussieu.fr>
    Date: Fri Oct 28 15:28:16 2011 +0200

    Fix #2832120: cilly does not pass linker flags

    The "-Wl," wrapper for linker flags used to be stripped, which caused
    linker flags to be ignored.

    The new behaviour preserves "-Wl,". Note that this might break library
    linking (when ld is called directly by cilly); no idea how to fix that
    currently.

     
  • Gabriel Kerneis

    Gabriel Kerneis - 2011-10-28
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.