From: Simon Ruderich Date: Tue, 13 Mar 2012 21:10:13 +0000 (+0100) Subject: Support versioned libraries (e.g. test.so.1.0.0). X-Git-Tag: 0.01~132 X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=commitdiff_plain;h=dc76b3697c03b4f9f9a2ab3c354207a3f6db15bf Support versioned libraries (e.g. test.so.1.0.0). --- diff --git a/bin/blhc b/bin/blhc index f43b593..030dd21 100755 --- a/bin/blhc +++ b/bin/blhc @@ -271,7 +271,7 @@ foreach my $line (@input) { # Linker commands. if ($line =~ /\s-l[A-Za-z0-9.-]+(\s|\\|$)/ - or $line =~ m{\s-o ([A-Za-z0-9_/.-]+/)?[A-Za-z0-9_-]+(\.so|\.la)?(\s|\\|\$)} + or $line =~ m{\s-o ([A-Za-z0-9_/.-]+/)?[A-Za-z0-9_-]+(\.so([0-9.])*|\.la)?(\s|\\|\$)} or $line =~ /^libtool: link: / or $line =~ m{\s*/bin/bash .+?libtool\s+(.+?\s+)?--mode=(re)?link}) { $compiler = 0; diff --git a/t/logs/bad-library b/t/logs/bad-library index 32765c3..042c58d 100644 --- a/t/logs/bad-library +++ b/t/logs/bad-library @@ -1,3 +1,5 @@ gcc -D_FORTIFY_SOURCE=2 -g -O2 --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.o gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,relro -Wl,--as-needed -o libtest.so gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,--as-needed -o libtest.so + +gcc -shared -fPIC test.o -Wl,-z -Wl,relro -o .libs/libtest.so.1.0.0 diff --git a/t/logs/good-library b/t/logs/good-library index c160a8a..c077840 100644 --- a/t/logs/good-library +++ b/t/logs/good-library @@ -2,3 +2,5 @@ # libraries. gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.o gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,relro -Wl,now -Wl,--as-needed -o libtest.so + +gcc -shared -fPIC test.o -Wl,-z -Wl,relro -Wl,now -o .libs/libtest.so.1.0.0 diff --git a/t/tests.t b/t/tests.t index efbb120..1d40f82 100644 --- a/t/tests.t +++ b/t/tests.t @@ -276,6 +276,7 @@ is_blhc 'bad-library', '--all', 4, "CFLAGS missing (-fstack-protector): gcc -D_FORTIFY_SOURCE=2 -g -O2 --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.o LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,relro -Wl,--as-needed -o libtest.so LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,--as-needed -o libtest.so +LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC test.o -Wl,-z -Wl,relro -o .libs/libtest.so.1.0.0 ";