From 99243a356c2d5a818b8d1bffb354cd38d2424146 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 16 Mar 2012 05:50:09 +0100 Subject: [PATCH] Support filenames which contain "~". --- bin/blhc | 4 ++-- t/logs/c++ | 2 ++ t/logs/cc | 2 ++ t/logs/g++ | 2 ++ t/logs/gcc | 2 ++ t/logs/libtool | 1 + t/tests.t | 5 +++++ 7 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/blhc b/bin/blhc index 67dce4a..03e8ebf 100755 --- a/bin/blhc +++ b/bin/blhc @@ -338,8 +338,8 @@ for (my $i = 0; $i < scalar @input; $i++) { # Linker commands. if ($line =~ m{\s-o # -o [\s\\]*\s+ # possible line continuation - (?:[A-Za-z0-9_/.-]+/)? # path to file - [A-Za-z0-9_-]+ # binary name (no dots!) + (?:[/.A-Za-z0-9~_-]+/)? # path to file + [A-Za-z0-9~_-]+ # binary name (no dots!) (?:[0-9.]*\.so[0-9.]*[a-z]? # library (including version) |\.la)? (?:\s|\\|\$) # end of file name diff --git a/t/logs/c++ b/t/logs/c++ index 107ba1a..e3828ce 100644 --- a/t/logs/c++ +++ b/t/logs/c++ @@ -10,6 +10,8 @@ c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-securit test-d.cc:47:11: warning: unused variable 'test' [-Wunused-variable] c++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest +c++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o + rm c++test.h c++\ test.c diff --git a/t/logs/cc b/t/logs/cc index c9dcc44..9035202 100644 --- a/t/logs/cc +++ b/t/logs/cc @@ -3,3 +3,5 @@ cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror= cc -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c cc -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest + +cc -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o diff --git a/t/logs/g++ b/t/logs/g++ index ba4a8f3..fd9d4d2 100644 --- a/t/logs/g++ +++ b/t/logs/g++ @@ -10,6 +10,8 @@ g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-securit test-d.cc:47:11: warning: unused variable 'test' [-Wunused-variable] g++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest +g++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o + g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp g++-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp diff --git a/t/logs/gcc b/t/logs/gcc index b9e0403..56eb38f 100644 --- a/t/logs/gcc +++ b/t/logs/gcc @@ -5,3 +5,5 @@ gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -We gcc-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c gcc-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest + +gcc-4.6 -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o diff --git a/t/logs/libtool b/t/logs/libtool index c068265..0428061 100644 --- a/t/logs/libtool +++ b/t/logs/libtool @@ -9,6 +9,7 @@ libtool: link: gcc -Wl,-z -Wl,relro -o test test.o /bin/bash ../../../libtool --mode=link cc -Wl,-z,relro -o test.so test.o /bin/bash ../../../libtool --mode=link gcc-4.6 -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/test-4.2~_4711/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 diff --git a/t/tests.t b/t/tests.t index d4d3268..d088852 100644 --- a/t/tests.t +++ b/t/tests.t @@ -322,6 +322,7 @@ CFLAGS missing (-Wformat -fPIE): cc -g -O2 -fstack-protector --param=ssp-buffer- CFLAGS missing (--param=ssp-buffer-size=4 -fPIE): cc -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c CFLAGS missing (-Werror=format-security -fPIE): cc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c LDFLAGS missing (-Wl,-z,relro -fPIE -pie -Wl,-z,now): cc -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest +LDFLAGS missing (-fPIE -pie -Wl,-z,now): cc -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o '; @@ -333,6 +334,7 @@ CFLAGS missing (-Wformat -fPIE): gcc-4.6 -g -O2 -fstack-protector --param=ssp-bu CFLAGS missing (--param=ssp-buffer-size=4 -fPIE): gcc-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c CFLAGS missing (-Werror=format-security -fPIE): gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c LDFLAGS missing (-Wl,-z,relro -fPIE -pie -Wl,-z,now): gcc-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest +LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc-4.6 -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o '; @@ -351,6 +353,7 @@ CFLAGS missing (--param=ssp-buffer-size=4 -fPIE): c++ -g -O2 -fstack-protector - CFLAGS missing (-Werror=format-security -fPIE): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp CFLAGS missing (-fPIE): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-Wl,-z,relro -fPIE -pie -Wl,-z,now): c++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest +LDFLAGS missing (-fPIE -pie -Wl,-z,now): c++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIE): c++\ test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\ test.c CFLAGS missing (-Wformat -fPIE): c++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp @@ -369,6 +372,7 @@ CFLAGS missing (--param=ssp-buffer-size=4 -fPIE): g++ -g -O2 -fstack-protector - CFLAGS missing (-Werror=format-security -fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp CFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-Wl,-z,relro -fPIE -pie -Wl,-z,now): g++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest +LDFLAGS missing (-fPIE -pie -Wl,-z,now): g++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o CFLAGS missing (-Wformat -fPIE): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp CFLAGS missing (--param=ssp-buffer-size=4 -fPIE): g++-4.6 -g -O2 -fstack-protector -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp CFLAGS missing (-Werror=format-security -fPIE): g++-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp @@ -389,6 +393,7 @@ 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 --mode=link cc -Wl,-z,relro -o test.so test.o LDFLAGS missing (-fPIE -pie -Wl,-z,now): /bin/bash ../../../libtool --mode=link gcc-4.6 -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/test-4.2~_4711/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 -- 2.45.2