aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emulparams')
-rw-r--r--ld/emulparams/call_nop.sh48
-rw-r--r--ld/emulparams/elf32_x86_64.sh1
-rw-r--r--ld/emulparams/elf_i386.sh1
-rw-r--r--ld/emulparams/elf_i386_be.sh1
-rw-r--r--ld/emulparams/elf_i386_chaos.sh1
-rw-r--r--ld/emulparams/elf_i386_ldso.sh1
-rw-r--r--ld/emulparams/elf_i386_vxworks.sh1
-rw-r--r--ld/emulparams/elf_iamcu.sh1
-rw-r--r--ld/emulparams/elf_k1om.sh1
-rw-r--r--ld/emulparams/elf_l1om.sh1
-rw-r--r--ld/emulparams/elf_x86_64.sh1
11 files changed, 58 insertions, 0 deletions
diff --git a/ld/emulparams/call_nop.sh b/ld/emulparams/call_nop.sh
new file mode 100644
index 0000000..fee4a81
--- /dev/null
+++ b/ld/emulparams/call_nop.sh
@@ -0,0 +1,48 @@
+PARSE_AND_LIST_OPTIONS_CALL_NOP='
+ fprintf (file, _("\
+ -z call-nop=PADDING Use PADDING as 1-byte NOP for branch\n"));
+'
+PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP='
+ else if (strncmp (optarg, "call-nop=", 9) == 0)
+ {
+ if (strcmp (optarg + 9, "prefix-addr") == 0)
+ {
+ link_info.call_nop_as_suffix = FALSE;
+ link_info.call_nop_byte = 0x67;
+ }
+ else if (strcmp (optarg + 9, "prefix-nop") == 0)
+ {
+ link_info.call_nop_as_suffix = FALSE;
+ link_info.call_nop_byte = 0x90;
+ }
+ else if (strcmp (optarg + 9, "suffix-nop") == 0)
+ {
+ link_info.call_nop_as_suffix = TRUE;
+ link_info.call_nop_byte = 0x90;
+ }
+ else if (strncmp (optarg + 9, "prefix-", 7) == 0)
+ {
+ char *end;
+ link_info.call_nop_byte = strtoul (optarg + 16 , &end, 0);
+ if (*end)
+ einfo (_("%P%F: invalid number for -z call-nop=prefix-: %s\n"),
+ optarg + 16);
+ link_info.call_nop_as_suffix = FALSE;
+ }
+ else if (strncmp (optarg + 9, "suffix-", 7) == 0)
+ {
+ char *end;
+ link_info.call_nop_byte = strtoul (optarg + 16, &end, 0);
+ if (*end)
+ einfo (_("%P%F: invalid number for -z call-nop=suffix-: %s\n"),
+ optarg + 16);
+ link_info.call_nop_as_suffix = TRUE;
+ }
+ else
+ einfo (_("%P%F: unsupported option: -z %s\n"), optarg);
+ }
+'
+
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_CALL_NOP"
+PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP"
+CALL_NOP_BYTE=0x67
diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh
index 8fd96fb..0a03548 100644
--- a/ld/emulparams/elf32_x86_64.sh
+++ b/ld/emulparams/elf32_x86_64.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
ELFSIZE=32
OUTPUT_FORMAT="elf32-x86-64"
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index ae87f6b..7dceea9 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
NO_RELA_RELOCS=yes
diff --git a/ld/emulparams/elf_i386_be.sh b/ld/emulparams/elf_i386_be.sh
index 06a80c7..40ed8c6 100644
--- a/ld/emulparams/elf_i386_be.sh
+++ b/ld/emulparams/elf_i386_be.sh
@@ -1,4 +1,5 @@
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
NO_RELA_RELOCS=yes
diff --git a/ld/emulparams/elf_i386_chaos.sh b/ld/emulparams/elf_i386_chaos.sh
index c59dbce..33757bf 100644
--- a/ld/emulparams/elf_i386_chaos.sh
+++ b/ld/emulparams/elf_i386_chaos.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf_chaos
OUTPUT_FORMAT="elf32-i386"
TEXT_START_ADDR=0x40000000
diff --git a/ld/emulparams/elf_i386_ldso.sh b/ld/emulparams/elf_i386_ldso.sh
index 7fd08fe..f780581 100644
--- a/ld/emulparams/elf_i386_ldso.sh
+++ b/ld/emulparams/elf_i386_ldso.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
NO_RELA_RELOCS=yes
diff --git a/ld/emulparams/elf_i386_vxworks.sh b/ld/emulparams/elf_i386_vxworks.sh
index 306e8d3..cb289e6 100644
--- a/ld/emulparams/elf_i386_vxworks.sh
+++ b/ld/emulparams/elf_i386_vxworks.sh
@@ -12,3 +12,4 @@ GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
. ${srcdir}/emulparams/vxworks.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
diff --git a/ld/emulparams/elf_iamcu.sh b/ld/emulparams/elf_iamcu.sh
index 39c7a57..5fae651 100644
--- a/ld/emulparams/elf_iamcu.sh
+++ b/ld/emulparams/elf_iamcu.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-iamcu"
NO_RELA_RELOCS=yes
diff --git a/ld/emulparams/elf_k1om.sh b/ld/emulparams/elf_k1om.sh
index 0cd606a..289274d 100644
--- a/ld/emulparams/elf_k1om.sh
+++ b/ld/emulparams/elf_k1om.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-k1om"
diff --git a/ld/emulparams/elf_l1om.sh b/ld/emulparams/elf_l1om.sh
index 1964e85..17fa8e2 100644
--- a/ld/emulparams/elf_l1om.sh
+++ b/ld/emulparams/elf_l1om.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-l1om"
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index a304771..5d31da1 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -1,5 +1,6 @@
. ${srcdir}/emulparams/plt_unwind.sh
. ${srcdir}/emulparams/extern_protected_data.sh
+. ${srcdir}/emulparams/call_nop.sh
SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-x86-64"