aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2012-01-24 06:21:11 +0000
committerIan Lance Taylor <ian@airs.com>2012-01-24 06:21:11 +0000
commit9dee3b3c89077e7a5dd4720077af0c667534219d (patch)
tree4d154e67608bf589f0cf00d97095db81f4c1f145
parent42bc6e0f9561c2fe2bba0153ec426792fe97aaa5 (diff)
downloadgdb-9dee3b3c89077e7a5dd4720077af0c667534219d.zip
gdb-9dee3b3c89077e7a5dd4720077af0c667534219d.tar.gz
gdb-9dee3b3c89077e7a5dd4720077af0c667534219d.tar.bz2
PR gold/13617
* i386.cc (Target_i386::do_code_fill): When using a jmp instruction, pad with nop instructions. * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/i386.cc5
-rw-r--r--gold/x86_64.cc5
3 files changed, 13 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 649668a..2c51569 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-23 Ian Lance Taylor <ian@airs.com>
+
+ PR gold/13617
+ * i386.cc (Target_i386::do_code_fill): When using a jmp
+ instruction, pad with nop instructions.
+ * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
+
2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
* x86_64.cc (gc_process_relocs): Add typename on types used in
diff --git a/gold/i386.cc b/gold/i386.cc
index efb6248..b4174bc 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -1,6 +1,7 @@
// i386.cc -- i386 target support for gold.
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -3470,7 +3471,7 @@ Target_i386::do_code_fill(section_size_type length) const
jmp[0] = 0xe9;
elfcpp::Swap_unaligned<32, false>::writeval(jmp + 1, length - 5);
return (std::string(reinterpret_cast<char*>(&jmp[0]), 5)
- + std::string(length - 5, '\0'));
+ + std::string(length - 5, static_cast<char>(0x90)));
}
// Nop sequences of various lengths.
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index df11441..cfc6384 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -1,6 +1,7 @@
// x86_64.cc -- x86_64 target support for gold.
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -3991,7 +3992,7 @@ Target_x86_64<size>::do_code_fill(section_size_type length) const
jmp[0] = 0xe9;
elfcpp::Swap_unaligned<32, false>::writeval(jmp + 1, length - 5);
return (std::string(reinterpret_cast<char*>(&jmp[0]), 5)
- + std::string(length - 5, '\0'));
+ + std::string(length - 5, static_cast<char>(0x90)));
}
// Nop sequences of various lengths.