From 9241a8bcf3da010eb1ec0ca6568e13243ce898ff Mon Sep 17 00:00:00 2001
From: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Fri, 13 Jan 2012 18:39:31 +0000
Subject: [PATCH] 2012-01-13  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb.base/attach-pie-misread.exp: Pass -pie only to the linker.
	* gdb.base/pie-execl.exp: Likewise.
---
 gdb/testsuite/ChangeLog                       | 5 +++++
 gdb/testsuite/gdb.base/attach-pie-misread.exp | 4 ++--
 gdb/testsuite/gdb.base/pie-execl.exp          | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index fa4141ebc19..0ae1a9722b8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-13  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+	* gdb.base/attach-pie-misread.exp: Pass -pie only to the linker.
+	* gdb.base/pie-execl.exp: Likewise.
+
 2012-01-12  Keith Seitz  <keiths@redhat.com>
 
 	PR mi/10586
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp
index 7a68c3393d6..65477a9eb8d 100644
--- a/gdb/testsuite/gdb.base/attach-pie-misread.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -27,7 +27,7 @@ set genfile ${objdir}/${subdir}/${test}-gen.h
 set executable ${test}
 set binfile ${objdir}/${subdir}/${executable}
 
-if {[build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie"]] == ""} {
+if {[build_executable_own_libs ${test}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} {
     return -1
 }
 
@@ -97,7 +97,7 @@ if {$result == 0} {
     fail $test
 }
 
-set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]]
+set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -DGEN=\"$genfile\"" "ldflags=-pie"]]
 if {$prelink_args == ""} {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/pie-execl.exp b/gdb/testsuite/gdb.base/pie-execl.exp
index 6ac2acf1602..8b6da71fecb 100644
--- a/gdb/testsuite/gdb.base/pie-execl.exp
+++ b/gdb/testsuite/gdb.base/pie-execl.exp
@@ -37,7 +37,7 @@ set binfile2_test_msg OBJDIR/${subdir}/${executable2}
 # Use conditional compilation according to `BIN' as GDB remembers the source
 # file name of the breakpoint.
 
-set opts [list debug {additional_flags=-fPIE -pie}]
+set opts [list debug additional_flags=-fPIE ldflags=-pie]
 if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == ""
     || [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == ""} {
     return -1