libtool
[Top][All Lists]
Advanced

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

Re: -export-symbols-regex seems to produce wrong version maps


From: Jan Engelhardt
Subject: Re: -export-symbols-regex seems to produce wrong version maps
Date: Tue, 18 Feb 2014 11:24:01 +0100 (CET)
User-agent: Alpine 2.11 (LSU 23 2013-08-11)

On Sunday 2014-02-16 13:26, Jan Engelhardt wrote:
>
>When -export-symbols-regex is passed to libtool (for example
>in the systems source), it generates a version map that gold
>does not like:
>[...]
>$ cat .libs/libgudev-1.0.ver
>
>{ global:
>local: *; };

How to trigger this: -export-symbols-regex RegexThatMatchesNoSymbols

Actually, what the linker does not like is the lack of a symbol name
after "global:". Unfortunately, GNU ld.bfd and ld.gold also dislike
"global: ;" and also dislikes "global: matched_symbol;;", so we can't
just add a semicolon unconditionally. Not very flexible :-(

On the upside, if the regex does not match any symbols, the
developer is definitely going to notice due to the failing ld.
Except that getting to this conclusion is not obvious at all yet.
In short: a message ought to be printed that the regex did not
match anything.

Long story short, something like this:

@@ -349,7 +349,9 @@ old_archive_from_expsyms_cmds=""
 # Commands used to build a shared archive.
 archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags 
\${wl}-soname \$wl\$soname -o \$lib"
 archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
-           cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> 
\$output_objdir/\$libname.ver~
+           cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> 
\$output_objdir/\$libname.ve2~
+           if test -z \$output_objdir/\$libname.ve2~; then echo 
WARNING_REGEX_MATCH_FAILED__YOUR_BUILD_CAN_FAIL; fi
+           cat \$output_objdir/\$libname.ve2~ >>\$output_objdir/\$libname.ver~
            echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
            \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags 
\${wl}-soname \$wl\$soname \${wl}-version-script 
\${wl}\$output_objdir/\$libname.ver -o \$lib"
 



reply via email to

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