libtool
[Top][All Lists]
Advanced

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

Problem with -export-symbols-regex and symbol prefix


From: Will Newton
Subject: Problem with -export-symbols-regex and symbol prefix
Date: Wed, 30 Sep 2009 17:09:03 +0100

Hi all,

I am trying to build some mainstream packages on a non-mainstream
Linux architecture that prepends an underscore to symbol names (e.g.,
"foo" in C is "_foo" to the linker). Many packages will limit the
number of symbols they export with -export-symbols-regex e.g.,
-export-symbols-regex "mysyms_*". This doesn't work for my
architecture even though libtool appears to understand that a symbol
prefix is needed to some degree.

The generated libtool I get has the following definitions:

global_symbol_pipe="sed -n -e 's/^.*[
]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[       ][
]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'"

export_symbols_cmds="\$NM \$libobjs \$convenience |
\$global_symbol_pipe | \$SED 's/.* //' | sort | uniq >
\$export_symbols"

The output of global_symbol_pipe looks something like this:

T _foo foo

The sed expression in export_symbols_cmds will then reduce this to:

foo

This is the symbol name that is used in the linker version script. But
ld doesn't know anything about unprefixed symbol names so I end up
with no global symbols in the resulting binary.

It seems to me like it might be more appropriate for the sed
expression in export_symbols_cmds to pick out the second word rather
than the third, something like:

export_symbols_cmds="\$NM \$libobjs \$convenience |
\$global_symbol_pipe | \$SED 's/[^ ]* \\([^ ]*\\) .*/\\1/' | sort |
uniq > \$export_symbols"

Or would that be incorrect?

Thanks,

(Please cc me, I'm not subscribed)




reply via email to

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