From 7ed04bee58679b3e9e267b486ce796928b961639 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 11 Mar 2012 18:39:09 +0100 Subject: [PATCH] bin/blhc: Improve regex for libtool --mode=link (and relink). Also add tests. --- bin/blhc | 2 +- t/logs/libtool | 4 ++++ t/tests.t | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/blhc b/bin/blhc index 73548dc..30bc35a 100755 --- a/bin/blhc +++ b/bin/blhc @@ -272,7 +272,7 @@ foreach my $line (@input) { # Linker commands. if ($line =~ /\s-l[A-Za-z0-9.-]+(\s|\\|$)/ or $line =~ /^libtool: link: / - or $line =~ m{\s*/bin/bash (\.\./)+libtool\s+--tag=CC\s+--mode=link}) { + or $line =~ m{\s*/bin/bash .+?libtool\s+.+?\s+--mode=(re)?link}) { $compiler = 0; $linker = 1; } diff --git a/t/logs/libtool b/t/logs/libtool index a948e74..d85ca49 100644 --- a/t/logs/libtool +++ b/t/logs/libtool @@ -7,11 +7,15 @@ libtool: link: gcc -Wl,-z -Wl,relro -o test test.o /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.o /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.o /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.o +/bin/bash ../../libtool --tag=CC --preserve-dup-deps --mode=link gcc -Wl,-z,relro -o test.so test.o + /bin/bash /tmp/test/build/libtool --silent --tag CC --mode=relink gcc -Wl,-z,relro -o test.so test.o + /bin/bash /tmp/test/build/libtool --tag CXX --mode=relink g++ -Wl,-z,relro -o test.la test.o # Just to be sure, libtool won't do this. Note the test.c. /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.c libtool: install: /usr/bin/install -c ... +/bin/bash ./libtool --mode=install /usr/bin/install -c ... /bin/bash ../../libtool --mode=install /usr/bin/install -c ... /bin/bash ../../libtool --mode=install /usr/bin/install -c ... /bin/bash ../../../libtool --mode=install /usr/bin/install -c ... diff --git a/t/tests.t b/t/tests.t index ad33134..6904a7d 100644 --- a/t/tests.t +++ b/t/tests.t @@ -311,6 +311,9 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z -Wl,relro -o LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.o +LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../../libtool --tag=CC --preserve-dup-deps --mode=link gcc -Wl,-z,relro -o test.so test.o +LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash /tmp/test/build/libtool --silent --tag CC --mode=relink gcc -Wl,-z,relro -o test.so test.o +LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash /tmp/test/build/libtool --tag CXX --mode=relink g++ -Wl,-z,relro -o test.la test.o CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIE): /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.c LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../libtool --tag=CC --mode=link gcc -Wl,-z,relro -o test.so test.c -- 2.45.2