diff options
| author | Saul Wold <sgw@linux.intel.com> | 2015-06-26 14:22:56 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-08 13:07:15 +0100 |
| commit | 5cdbf0ad06e617f49099618a36b9d15cce9b0965 (patch) | |
| tree | 2159cc86cc8b9494fa094810e213d951cb432e39 | |
| parent | 33973cd841803dbe0d917897d2e4985baee47232 (diff) | |
| download | poky-5cdbf0ad06e617f49099618a36b9d15cce9b0965.tar.gz | |
binutils: Add -momit-lock-prefix support
This patch is needed for certain cpus and has been accepted into upstream
(From OE-Core rev: 3371b42a4ac5becb063157f1b258918601211ebf)
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.24.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils/0001-Add-momit_lock_prefix-no-yes-option.patch | 236 |
2 files changed, 237 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.24.inc b/meta/recipes-devtools/binutils/binutils-2.24.inc index 2fb56eb4af..e71a110d34 100644 --- a/meta/recipes-devtools/binutils/binutils-2.24.inc +++ b/meta/recipes-devtools/binutils/binutils-2.24.inc | |||
| @@ -41,6 +41,7 @@ SRC_URI = "\ | |||
| 41 | file://binutils_CVE-2014-8504.patch \ | 41 | file://binutils_CVE-2014-8504.patch \ |
| 42 | file://binutils_CVE-2014-8737.patch \ | 42 | file://binutils_CVE-2014-8737.patch \ |
| 43 | file://Fix-tc-i386.c-Werror-logical-not-parentheses-error.patch \ | 43 | file://Fix-tc-i386.c-Werror-logical-not-parentheses-error.patch \ |
| 44 | file://0001-Add-momit_lock_prefix-no-yes-option.patch \ | ||
| 44 | " | 45 | " |
| 45 | 46 | ||
| 46 | SRC_URI[md5sum] = "e0f71a7b2ddab0f8612336ac81d9636b" | 47 | SRC_URI[md5sum] = "e0f71a7b2ddab0f8612336ac81d9636b" |
diff --git a/meta/recipes-devtools/binutils/binutils/0001-Add-momit_lock_prefix-no-yes-option.patch b/meta/recipes-devtools/binutils/binutils/0001-Add-momit_lock_prefix-no-yes-option.patch new file mode 100644 index 0000000000..e56891f9f3 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0001-Add-momit_lock_prefix-no-yes-option.patch | |||
| @@ -0,0 +1,236 @@ | |||
| 1 | From ee57d586166f36f4a6bddaa2305fd66a7752f967 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ilya Tocar <ilya.tocar@intel.com> | ||
| 3 | Date: Fri, 1 Aug 2014 17:58:32 +0400 | ||
| 4 | Subject: [PATCH] Add -momit_lock_prefix=[no|yes] option | ||
| 5 | |||
| 6 | This option serves as a workaround for processors, which fail on lock | ||
| 7 | prefix. | ||
| 8 | |||
| 9 | gas/ | ||
| 10 | * config/tc-i386.c (omit_lock_prefix): New. | ||
| 11 | (output_insn): Omit lock prefix if omit_lock_prefix is true. | ||
| 12 | (OPTION_omit_lock_prefix): New. | ||
| 13 | (md_longopts): Add momit-lock-prefix. | ||
| 14 | (md_parse_option): Handle momit-lock-prefix. | ||
| 15 | (md_show_usage): Add momit-lock-prefix=[no|yes]. | ||
| 16 | * doc/c-i386.texi (momit-lock-prefix): Document. | ||
| 17 | |||
| 18 | gas/testsuite/ | ||
| 19 | |||
| 20 | * gas/i386/i386.exp: Run new tests. | ||
| 21 | * gas/i386/omit-lock-no.d: New. | ||
| 22 | * gas/i386/omit-lock-yes.d: Ditto. | ||
| 23 | * gas/i386/omit-lock.s: Ditto. | ||
| 24 | |||
| 25 | Cherry-pick from git://sourceware.org/git/binutils-gdb.git | ||
| 26 | rev d022bddd4fd93428a7fa3cc7ad404c912ed20dbf | ||
| 27 | into binutils v2.24 | ||
| 28 | |||
| 29 | Upstream-Status: [Accepted] | ||
| 30 | Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com> | ||
| 31 | Signed-off-by: Saul Wold <sgw@linux.intel.com> | ||
| 32 | --- | ||
| 33 | gas/ChangeLog | 10 ++++++++++ | ||
| 34 | gas/config/tc-i386.c | 27 +++++++++++++++++++++++++++ | ||
| 35 | gas/doc/c-i386.texi | 12 ++++++++++++ | ||
| 36 | gas/testsuite/ChangeLog | 7 +++++++ | ||
| 37 | gas/testsuite/gas/i386/i386.exp | 2 ++ | ||
| 38 | gas/testsuite/gas/i386/omit-lock-no.d | 12 ++++++++++++ | ||
| 39 | gas/testsuite/gas/i386/omit-lock-yes.d | 12 ++++++++++++ | ||
| 40 | gas/testsuite/gas/i386/omit-lock.s | 6 ++++++ | ||
| 41 | 8 files changed, 88 insertions(+) | ||
| 42 | create mode 100644 gas/testsuite/gas/i386/omit-lock-no.d | ||
| 43 | create mode 100644 gas/testsuite/gas/i386/omit-lock-yes.d | ||
| 44 | create mode 100644 gas/testsuite/gas/i386/omit-lock.s | ||
| 45 | |||
| 46 | Index: binutils-2.24/gas/ChangeLog | ||
| 47 | =================================================================== | ||
| 48 | --- binutils-2.24.orig/gas/ChangeLog | ||
| 49 | +++ binutils-2.24/gas/ChangeLog | ||
| 50 | @@ -4,6 +4,17 @@ | ||
| 51 | single-bit bitfields. | ||
| 52 | (build_modrm_byte): Don't compare single-bit bitfields to "1". | ||
| 53 | |||
| 54 | +2014-08-06 Ilya Tocar <ilya.tocar@intel.com> | ||
| 55 | + | ||
| 56 | + * config/tc-i386.c (omit_lock_prefix): New. | ||
| 57 | + (output_insn): Omit lock prefix if omit_lock_prefix is true. | ||
| 58 | + (OPTION_omit_lock_prefix): New. | ||
| 59 | + (md_longopts): Add momit-lock-prefix. | ||
| 60 | + (md_parse_option): Handle momit-lock-prefix. | ||
| 61 | + (md_show_usage): Add momit-lock-prefix=[no|yes]. | ||
| 62 | + * doc/c-i386.texi (momit-lock-prefix): Document. | ||
| 63 | + | ||
| 64 | + | ||
| 65 | 2013-11-18 H.J. Lu <hongjiu.lu@intel.com> | ||
| 66 | |||
| 67 | * config/tc-i386.c (lex_got): Add a dummy "int bnd_prefix" | ||
| 68 | Index: binutils-2.24/gas/config/tc-i386.c | ||
| 69 | =================================================================== | ||
| 70 | --- binutils-2.24.orig/gas/config/tc-i386.c | ||
| 71 | +++ binutils-2.24/gas/config/tc-i386.c | ||
| 72 | @@ -541,6 +541,10 @@ static int add_bnd_prefix = 0; | ||
| 73 | /* 1 if pseudo index register, eiz/riz, is allowed . */ | ||
| 74 | static int allow_index_reg = 0; | ||
| 75 | |||
| 76 | +/* 1 if the assembler should ignore LOCK prefix, even if it was | ||
| 77 | + specified explicitly. */ | ||
| 78 | +static int omit_lock_prefix = 0; | ||
| 79 | + | ||
| 80 | static enum check_kind | ||
| 81 | { | ||
| 82 | check_none = 0, | ||
| 83 | @@ -6910,6 +6914,15 @@ output_insn (void) | ||
| 84 | unsigned int j; | ||
| 85 | unsigned int prefix; | ||
| 86 | |||
| 87 | + /* Some processors fail on LOCK prefix. This options makes | ||
| 88 | + assembler ignore LOCK prefix and serves as a workaround. */ | ||
| 89 | + if (omit_lock_prefix) | ||
| 90 | + { | ||
| 91 | + if (i.tm.base_opcode == LOCK_PREFIX_OPCODE) | ||
| 92 | + return; | ||
| 93 | + i.prefix[LOCK_PREFIX] = 0; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | /* Since the VEX/EVEX prefix contains the implicit prefix, we | ||
| 97 | don't need the explicit prefix. */ | ||
| 98 | if (!i.tm.opcode_modifier.vex && !i.tm.opcode_modifier.evex) | ||
| 99 | @@ -9483,6 +9496,7 @@ const char *md_shortopts = "qn"; | ||
| 100 | #define OPTION_MADD_BND_PREFIX (OPTION_MD_BASE + 15) | ||
| 101 | #define OPTION_MEVEXLIG (OPTION_MD_BASE + 16) | ||
| 102 | #define OPTION_MEVEXWIG (OPTION_MD_BASE + 17) | ||
| 103 | +#define OPTION_omit_lock_prefix (OPTION_MD_BASE + 18) | ||
| 104 | |||
| 105 | struct option md_longopts[] = | ||
| 106 | { | ||
| 107 | @@ -9509,6 +9523,7 @@ struct option md_longopts[] = | ||
| 108 | {"madd-bnd-prefix", no_argument, NULL, OPTION_MADD_BND_PREFIX}, | ||
| 109 | {"mevexlig", required_argument, NULL, OPTION_MEVEXLIG}, | ||
| 110 | {"mevexwig", required_argument, NULL, OPTION_MEVEXWIG}, | ||
| 111 | + {"momit-lock-prefix", required_argument, NULL, OPTION_omit_lock_prefix}, | ||
| 112 | {NULL, no_argument, NULL, 0} | ||
| 113 | }; | ||
| 114 | size_t md_longopts_size = sizeof (md_longopts); | ||
| 115 | @@ -9790,6 +9805,15 @@ md_parse_option (int c, char *arg) | ||
| 116 | as_fatal (_("invalid -mevexwig= option: `%s'"), arg); | ||
| 117 | break; | ||
| 118 | |||
| 119 | + case OPTION_omit_lock_prefix: | ||
| 120 | + if (strcasecmp (arg, "yes") == 0) | ||
| 121 | + omit_lock_prefix = 1; | ||
| 122 | + else if (strcasecmp (arg, "no") == 0) | ||
| 123 | + omit_lock_prefix = 0; | ||
| 124 | + else | ||
| 125 | + as_fatal (_("invalid -momit-lock-prefix= option: `%s'"), arg); | ||
| 126 | + break; | ||
| 127 | + | ||
| 128 | default: | ||
| 129 | return 0; | ||
| 130 | } | ||
| 131 | @@ -9942,6 +9966,9 @@ md_show_usage (FILE *stream) | ||
| 132 | -mold-gcc support old (<= 2.8.1) versions of gcc\n")); | ||
| 133 | fprintf (stream, _("\ | ||
| 134 | -madd-bnd-prefix add BND prefix for all valid branches\n")); | ||
| 135 | + fprintf (stream, _("\ | ||
| 136 | + -momit-lock-prefix=[no|yes]\n\ | ||
| 137 | + strip all lock prefixes\n")); | ||
| 138 | } | ||
| 139 | |||
| 140 | #if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \ | ||
| 141 | Index: binutils-2.24/gas/doc/c-i386.texi | ||
| 142 | =================================================================== | ||
| 143 | --- binutils-2.24.orig/gas/doc/c-i386.texi | ||
| 144 | +++ binutils-2.24/gas/doc/c-i386.texi | ||
| 145 | @@ -282,6 +282,18 @@ The @code{.att_syntax} and @code{.intel_ | ||
| 146 | This option forces the assembler to add BND prefix to all branches, even | ||
| 147 | if such prefix was not explicitly specified in the source code. | ||
| 148 | |||
| 149 | +@cindex @samp{-momit-lock-prefix=} option, i386 | ||
| 150 | +@cindex @samp{-momit-lock-prefix=} option, x86-64 | ||
| 151 | +@item -momit-lock-prefix=@var{no} | ||
| 152 | +@itemx -momit-lock-prefix=@var{yes} | ||
| 153 | +These options control how the assembler should encode lock prefix. | ||
| 154 | +This option is intended as a workaround for processors, that fail on | ||
| 155 | +lock prefix. This option can only be safely used with single-core, | ||
| 156 | +single-thread computers | ||
| 157 | +@option{-momit-lock-prefix=@var{yes}} will omit all lock prefixes. | ||
| 158 | +@option{-momit-lock-prefix=@var{no}} will encode lock prefix as usual, | ||
| 159 | +which is the default. | ||
| 160 | + | ||
| 161 | @end table | ||
| 162 | @c man end | ||
| 163 | |||
| 164 | Index: binutils-2.24/gas/testsuite/ChangeLog | ||
| 165 | =================================================================== | ||
| 166 | --- binutils-2.24.orig/gas/testsuite/ChangeLog | ||
| 167 | +++ binutils-2.24/gas/testsuite/ChangeLog | ||
| 168 | @@ -1,3 +1,10 @@ | ||
| 169 | +2014-08-06 Ilya Tocar <ilya.tocar@intel.com> | ||
| 170 | + | ||
| 171 | + * gas/i386/i386.exp: Run new tests. | ||
| 172 | + * gas/i386/omit-lock-no.d: New. | ||
| 173 | + * gas/i386/omit-lock-yes.d: Ditto. | ||
| 174 | + * gas/i386/omit-lock.s: Ditto.+ | ||
| 175 | + | ||
| 176 | 2013-11-20 Yufeng Zhang <yufeng.zhang@arm.com> | ||
| 177 | |||
| 178 | * gas/aarch64/msr.s: Add tests. | ||
| 179 | Index: binutils-2.24/gas/testsuite/gas/i386/i386.exp | ||
| 180 | =================================================================== | ||
| 181 | --- binutils-2.24.orig/gas/testsuite/gas/i386/i386.exp | ||
| 182 | +++ binutils-2.24/gas/testsuite/gas/i386/i386.exp | ||
| 183 | @@ -267,6 +267,8 @@ if [expr ([istarget "i*86-*-*"] || [ist | ||
| 184 | run_list_test "mpx-inval-1" "-al" | ||
| 185 | run_dump_test "mpx-add-bnd-prefix" | ||
| 186 | run_dump_test "sha" | ||
| 187 | + run_dump_test "omit-lock-yes" | ||
| 188 | + run_dump_test "omit-lock-no" | ||
| 189 | |||
| 190 | # These tests require support for 8 and 16 bit relocs, | ||
| 191 | # so we only run them for ELF and COFF targets. | ||
| 192 | Index: binutils-2.24/gas/testsuite/gas/i386/omit-lock-no.d | ||
| 193 | =================================================================== | ||
| 194 | --- /dev/null | ||
| 195 | +++ binutils-2.24/gas/testsuite/gas/i386/omit-lock-no.d | ||
| 196 | @@ -0,0 +1,12 @@ | ||
| 197 | +#source: omit-lock.s | ||
| 198 | +#as: -momit-lock-prefix=yes -momit-lock-prefix=no | ||
| 199 | +#objdump: -dw | ||
| 200 | +#name: i386 omit lock = no | ||
| 201 | + | ||
| 202 | +.*: +file format .*i386.* | ||
| 203 | + | ||
| 204 | +Disassembly of section .text: | ||
| 205 | + | ||
| 206 | +0+ <main>: | ||
| 207 | + 0: f0 f0 83 00 01 lock lock addl \$0x1,\(%eax\) | ||
| 208 | +#pass | ||
| 209 | Index: binutils-2.24/gas/testsuite/gas/i386/omit-lock-yes.d | ||
| 210 | =================================================================== | ||
| 211 | --- /dev/null | ||
| 212 | +++ binutils-2.24/gas/testsuite/gas/i386/omit-lock-yes.d | ||
| 213 | @@ -0,0 +1,12 @@ | ||
| 214 | +#source: omit-lock.s | ||
| 215 | +#as: -momit-lock-prefix=yes | ||
| 216 | +#objdump: -dw | ||
| 217 | +#name: i386 omit lock = yes | ||
| 218 | + | ||
| 219 | +.*: +file format .*i386.* | ||
| 220 | + | ||
| 221 | +Disassembly of section .text: | ||
| 222 | + | ||
| 223 | +0+ <main>: | ||
| 224 | + 0: 83 00 01 addl \$0x1,\(%eax\) | ||
| 225 | +#pass | ||
| 226 | Index: binutils-2.24/gas/testsuite/gas/i386/omit-lock.s | ||
| 227 | =================================================================== | ||
| 228 | --- /dev/null | ||
| 229 | +++ binutils-2.24/gas/testsuite/gas/i386/omit-lock.s | ||
| 230 | @@ -0,0 +1,6 @@ | ||
| 231 | + .code32 | ||
| 232 | +.globl main | ||
| 233 | + .type main, @function | ||
| 234 | +main: | ||
| 235 | + lock | ||
| 236 | + lock addl $0x1,(%eax) | ||
