summaryrefslogtreecommitdiffstats
path: root/lld/ELF
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-06-26 19:45:53 +0000
committerRui Ueyama <ruiu@google.com>2017-06-26 19:45:53 +0000
commit921d43fbb2db882e4cdf9dd10677b1ec069024f5 (patch)
tree5bdae0b31e90cc7803571d8470dc120635196d47 /lld/ELF
parenta21c8e14b609644f5a26416c0e585b4bae66a075 (diff)
downloadbcm5719-llvm-921d43fbb2db882e4cdf9dd10677b1ec069024f5.tar.gz
bcm5719-llvm-921d43fbb2db882e4cdf9dd10677b1ec069024f5.zip
Add trap instructions for ARM and MIPS.
This patch fills holes in executable sections with 0xd4 (ARM) or 0xef (MIPS). These trap instructions were suggested by Theo de Raadt. llvm-svn: 306322
Diffstat (limited to 'lld/ELF')
-rw-r--r--lld/ELF/Arch/ARM.cpp1
-rw-r--r--lld/ELF/Arch/Mips.cpp1
-rw-r--r--lld/ELF/Arch/X86.cpp4
-rw-r--r--lld/ELF/Arch/X86_64.cpp4
4 files changed, 4 insertions, 6 deletions
diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index a8a5ca15144..e4b06ade448 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -57,6 +57,7 @@ ARM::ARM() {
GotPltEntrySize = 4;
PltEntrySize = 16;
PltHeaderSize = 20;
+ TrapInstr = 0xd4d4d4d4;
// ARM uses Variant 1 TLS
TcbSize = 8;
NeedsThunks = true;
diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp
index 422e5db8ce2..b8d796f5897 100644
--- a/lld/ELF/Arch/Mips.cpp
+++ b/lld/ELF/Arch/Mips.cpp
@@ -54,6 +54,7 @@ template <class ELFT> MIPS<ELFT>::MIPS() {
CopyRel = R_MIPS_COPY;
PltRel = R_MIPS_JUMP_SLOT;
NeedsThunks = true;
+ TrapInstr = 0xefefefef;
if (ELFT::Is64Bits) {
RelativeRel = (R_MIPS_64 << 8) | R_MIPS_REL32;
diff --git a/lld/ELF/Arch/X86.cpp b/lld/ELF/Arch/X86.cpp
index f605a8583ba..a1e9bcaf1b1 100644
--- a/lld/ELF/Arch/X86.cpp
+++ b/lld/ELF/Arch/X86.cpp
@@ -60,9 +60,7 @@ X86::X86() {
PltEntrySize = 16;
PltHeaderSize = 16;
TlsGdRelaxSkip = 2;
-
- // 0xCC is the "int3" (call debug exception handler) instruction.
- TrapInstr = 0xcccccccc;
+ TrapInstr = 0xcccccccc; // 0xcc = INT3
}
RelExpr X86::getRelExpr(uint32_t Type, const SymbolBody &S,
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 569b44da93d..10179f57ee9 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -65,13 +65,11 @@ template <class ELFT> X86_64<ELFT>::X86_64() {
PltEntrySize = 16;
PltHeaderSize = 16;
TlsGdRelaxSkip = 2;
+ TrapInstr = 0xcccccccc; // 0xcc = INT3
// Align to the large page size (known as a superpage or huge page).
// FreeBSD automatically promotes large, superpage-aligned allocations.
DefaultImageBase = 0x200000;
-
- // 0xCC is the "int3" (call debug exception handler) instruction.
- TrapInstr = 0xcccccccc;
}
template <class ELFT>
OpenPOWER on IntegriCloud