From: guenther Date: Sat, 9 Aug 2014 04:59:02 +0000 (+0000) Subject: Backport from binutils-2.17 the correct i386/amd64 register->int assignments X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=241ee62137f58cebe5b7821f845bfda150dc8290;p=openbsd Backport from binutils-2.17 the correct i386/amd64 register->int assignments for CFI. This changes the unwind information generated on amd64. --- diff --git a/gnu/usr.bin/binutils/gas/config/tc-i386.c b/gnu/usr.bin/binutils/gas/config/tc-i386.c index a3128a083c7..427e74ac1fd 100644 --- a/gnu/usr.bin/binutils/gas/config/tc-i386.c +++ b/gnu/usr.bin/binutils/gas/config/tc-i386.c @@ -6213,21 +6213,44 @@ tc_x86_regname_to_dw2regnum (const char *regname) { unsigned int regnum; unsigned int regnames_count; - char *regnames_32[] = + static const char *const regnames_32[] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", - "eip" + "eip", "eflags", NULL, + "st0", "st1", "st2", "st3", + "st4", "st5", "st6", "st7", + NULL, NULL, + "xmm0", "xmm1", "xmm2", "xmm3", + "xmm4", "xmm5", "xmm6", "xmm7", + "mm0", "mm1", "mm2", "mm3", + "mm4", "mm5", "mm6", "mm7", + "fcw", "fsw", "mxcsr", + "es", "cs", "ss", "ds", "fs", "gs", NULL, NULL, + "tr", "ldtr" }; - char *regnames_64[] = + static const char *const regnames_64[] = { - "rax", "rbx", "rcx", "rdx", - "rdi", "rsi", "rbp", "rsp", - "r8", "r9", "r10", "r11", + "rax", "rdx", "rcx", "rbx", + "rsi", "rdi", "rbp", "rsp", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "rip" + "rip", + "xmm0", "xmm1", "xmm2", "xmm3", + "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", + "xmm12", "xmm13", "xmm14", "xmm15", + "st0", "st1", "st2", "st3", + "st4", "st5", "st6", "st7", + "mm0", "mm1", "mm2", "mm3", + "mm4", "mm5", "mm6", "mm7", + "rflags", + "es", "cs", "ss", "ds", "fs", "gs", NULL, NULL, + "fs.base", "gs.base", NULL, NULL, + "tr", "ldtr", + "mxcsr", "fcw", "fsw" }; - char **regnames; + const char *const *regnames; if (flag_code == CODE_64BIT) { @@ -6241,7 +6264,8 @@ tc_x86_regname_to_dw2regnum (const char *regname) } for (regnum = 0; regnum < regnames_count; regnum++) - if (strcmp (regname, regnames[regnum]) == 0) + if (regnames[regnum] != NULL + && strcmp (regname, regnames[regnum]) == 0) return regnum; return -1;