[prev in list] [next in list] [prev in thread] [next in thread]
List: binutils
Subject: gold patch committed: Always pad with nops
From: Ian Lance Taylor <iant () google ! com>
Date: 2012-01-24 6:22:29
Message-ID: m3sjj5mxga.fsf () pepe ! airs ! com
[Download RAW message or body]
PR 13617 asks that gold pad with nops even when it uses a jump. This
patch implements that. Committed to mainline.
Ian
2012-01-23 Ian Lance Taylor <iant@google.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.
["foo.patch" (text/x-patch)]
Index: i386.cc
===================================================================
RCS file: /cvs/src/src/gold/i386.cc,v
retrieving revision 1.143
diff -u -p -r1.143 i386.cc
--- i386.cc 17 Dec 2011 22:39:52 -0000 1.143
+++ i386.cc 24 Jan 2012 06:19:48 -0000
@@ -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_t
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.
Index: x86_64.cc
===================================================================
RCS file: /cvs/src/src/gold/x86_64.cc,v
retrieving revision 1.147
diff -u -p -r1.147 x86_64.cc
--- x86_64.cc 20 Jan 2012 00:43:57 -0000 1.147
+++ x86_64.cc 24 Jan 2012 06:19:48 -0000
@@ -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(sectio
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic