Add a test for non-PIE static executable

Message ID 20170928122308.GA5544@gmail.com
State Committed
Commit 2000067a4be0dc8a70f6d3704a9e8388eb9066c9
Headers

Commit Message

H.J. Lu Sept. 28, 2017, 12:23 p.m. UTC
  tst-tls1-static-non-pie is built with $(no-pie-ldflag) to make it a
non-PIE static executable, regardless if --enable-static-pie is used
to configure glibc.

Any comments?

H.J.
---
	* elf/Makefile (tests-static-internal): Add
	tst-tls1-static-non-pie.
	(LDFLAGS-tst-tls1-static-non-pie): New.
	* elf/tst-tls1-static-non-pie.c: New file.
---
 elf/Makefile                  | 5 ++++-
 elf/tst-tls1-static-non-pie.c | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
 create mode 100644 elf/tst-tls1-static-non-pie.c
  

Comments

H.J. Lu Sept. 30, 2017, 4:19 a.m. UTC | #1
On Thu, Sep 28, 2017 at 05:23:08AM -0700, H.J. Lu wrote:
> tst-tls1-static-non-pie is built with $(no-pie-ldflag) to make it a
> non-PIE static executable, regardless if --enable-static-pie is used
> to configure glibc.
> 
> Any comments?
> 
> H.J.
> ---
> 	* elf/Makefile (tests-static-internal): Add
> 	tst-tls1-static-non-pie.
> 	(LDFLAGS-tst-tls1-static-non-pie): New.
> 	* elf/tst-tls1-static-non-pie.c: New file.
> ---
>  elf/Makefile                  | 5 ++++-
>  elf/tst-tls1-static-non-pie.c | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
>  create mode 100644 elf/tst-tls1-static-non-pie.c
> 
> diff --git a/elf/Makefile b/elf/Makefile
> index e21f37e30b..c6edebd4ee 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -149,7 +149,10 @@ tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
>  	       tst-tlsalign-static tst-tlsalign-extern-static \
>  	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables
>  tests-static-internal := tst-tls1-static tst-tls2-static \
> -	       tst-ptrguard1-static tst-stackguard1-static
> +	       tst-ptrguard1-static tst-stackguard1-static \
> +	       tst-tls1-static-non-pie
> +
> +LDFLAGS-tst-tls1-static-non-pie = $(no-pie-ldflag)
>  
>  tests := tst-tls9 tst-leaks1 \
>  	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
> diff --git a/elf/tst-tls1-static-non-pie.c b/elf/tst-tls1-static-non-pie.c
> new file mode 100644
> index 0000000000..a01008073b
> --- /dev/null
> +++ b/elf/tst-tls1-static-non-pie.c
> @@ -0,0 +1 @@
> +#include "tst-tls1.c"
> -- 
> 2.13.5
> 

I am checking it in.

H.J.
  

Patch

diff --git a/elf/Makefile b/elf/Makefile
index e21f37e30b..c6edebd4ee 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -149,7 +149,10 @@  tests-static-normal := tst-leaks1-static tst-array1-static tst-array5-static \
 	       tst-tlsalign-static tst-tlsalign-extern-static \
 	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables
 tests-static-internal := tst-tls1-static tst-tls2-static \
-	       tst-ptrguard1-static tst-stackguard1-static
+	       tst-ptrguard1-static tst-stackguard1-static \
+	       tst-tls1-static-non-pie
+
+LDFLAGS-tst-tls1-static-non-pie = $(no-pie-ldflag)
 
 tests := tst-tls9 tst-leaks1 \
 	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
diff --git a/elf/tst-tls1-static-non-pie.c b/elf/tst-tls1-static-non-pie.c
new file mode 100644
index 0000000000..a01008073b
--- /dev/null
+++ b/elf/tst-tls1-static-non-pie.c
@@ -0,0 +1 @@ 
+#include "tst-tls1.c"