x86-64: Use $NOPIE_LDFLAGS/$NOPIE_CFLAGS on protected-func-1

	PR ld/27973
	* testsuite/ld-x86-64/x86-64.exp: Pass $NOPIE_LDFLAGS and
	$NOPIE_CFLAGS to protected-func-1 without PIE.
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2b46bb9..37a373b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,6 +1,12 @@
 2021-06-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/27973
+	* testsuite/ld-x86-64/x86-64.exp: Pass $NOPIE_LDFLAGS and
+	$NOPIE_CFLAGS to protected-func-1 without PIE.
+
+2021-06-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/27973
 	* testsuite/ld-x86-64/x86-64.exp: Run protected function tests.
 	* testsuite/ld-x86-64/protected-func-1.h: New file.
 	* testsuite/ld-x86-64/protected-func-1a.s: Likewise.
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 5dc9a1c..21a4824 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -1740,11 +1740,12 @@
 	] \
 	[list \
 	    "Run protected-func-1 without PIE" \
-	    "-Wl,--no-as-needed tmpdir/libprotected-func-1.so" \
+	    "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-1.so" \
 	    "-Wa,-mx86-used-note=yes" \
 	    { protected-func-1b.c } \
 	    "protected-func-1a" \
 	    "pass.out" \
+	    "$NOPIE_CFLAGS" \
 	] \
 	[list \
 	    "Run protected-func-1 with PIE" \