[PATCH] libkdeinit symbol pruning

Karl Vogel karl.vogel at seagha.com
Mon Jul 19 01:06:47 CEST 2004


David Faure wrote:

> On Sunday 18 July 2004 16:25, Karl Vogel wrote:
>> -                appendLines("libkdeinit_${kdeinit}_la_LDFLAGS =
>> -no-undefined -avoid-version \$(all_libraries)\n");
>> +                appendLines("libkdeinit_${kdeinit}_la_LDFLAGS =
>> -Wl,--version-script=\$(top_srcdir)/admin/kdeinit.map -no-undefined
>> -avoid-version \$(all_libraries)\n");
> 
> Looking at kdelibs/kjs/Makefile.am, I think this should read
> 
> if include_VERSION_SCRIPT
> KDEINIT_VSCRIPT = -Wl,--version-script=$(top_srcdir)/admin/kdeinit.map
> endif
> 
> libkdeinit_${kdeinit}_la_LDFLAGS = $(KDEINIT_VSCRIPT) -no-undefined
> -avoid-version \$(all_libraries)
> 
> so that it doesn't break on compilers without --version-script support.

Good point!

> Can you make am_edit and unsermake patches for the above?

The patch for am_edit is attached... have to look at how unsermake does it's
 magic a bit closer to make a patch.. but.. need some sleep first :)

> I'm inclined to commit the whole thing afterwards. Hmm, this will break
> for apps currently linking to kdeinit modules (right?), but that's

It will break apps that link to the libkdeinit_*.so's or dlopen them and try
 to resolve symbols other than kdemain... but I guess if any app does that,
 then it's already broken by violating the kde abi, no?!

> But, hmm, that makes it difficult to commit this while KDE is
> feature-frozen. I'll for sure use it locally from now on to see what needs
> to be fixed.

I wouldn't apply it to the feature frozen release! Too risky.


The fixed patch:


Index: am_edit
===================================================================
RCS file: /home/kde/kde-common/admin/am_edit,v
retrieving revision 1.411
diff -u -r1.411 am_edit
--- am_edit	24 Mar 2004 22:26:00 -0000	1.411
+++ am_edit	18 Jul 2004 22:49:55 -0000
@@ -865,6 +865,9 @@
     if ($MakefileData =~ m/\n$lookup/) {
 	@kdeinits = split(/[\034\s]+/, $1);
 	my $lines = "";
+	appendLines("if include_VERSION_SCRIPT\n");
+	appendLines("KDEINIT_VSCRIPT = -Wl,--version-script=\$(top_srcdir)/admin/kdeinit.map\n");
+	appendLines("endif\n");
 	foreach my $kdeinit (@kdeinits) {
 	    if ($kdeinit =~ m/\.la$/) {
 		$kdeinit =~ s/\.la$//;
@@ -892,7 +895,8 @@
                     substituteLine($lookup, "${kdeinit}_la_LIBADD = libkdeinit_${kdeinit}.la");
                     appendLines("libkdeinit_${kdeinit}_la_LIBADD = $libadd\n");
                 }
-                appendLines("libkdeinit_${kdeinit}_la_LDFLAGS = -no-undefined -avoid-version \$(all_libraries)\n");
+
+                appendLines("libkdeinit_${kdeinit}_la_LDFLAGS = \$(KDEINIT_VSCRIPT) -no-undefined -avoid-version \$(all_libraries)\n");
 
                 # add library dependencies
                 $lookup = $kdeinit . '_la_DEPENDENCIES\s*=[ \t]*(.*)';



Don't forget the kdeinit.map file too!


More information about the Kde-optimize mailing list