From: H.J. Lu Date: Mon, 22 Mar 2010 13:49:50 +0000 (+0000) Subject: Use STRING_COMMA_LEN to avoid strlen. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cff8d58ab4a99c8fdcc1572227f9957064b1aaa0;p=binutils-gdb.git Use STRING_COMMA_LEN to avoid strlen. 2010-03-22 H.J. Lu * config/tc-i386.c (lex_got): Use STRING_COMMA_LEN on gotrel. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index d6bffc19099..11866d6b6c8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2010-03-22 H.J. Lu + + * config/tc-i386.c (lex_got): Use STRING_COMMA_LEN on gotrel. + 2010-03-21 H.J. Lu * config/tc-i386.c (i386_error): Replace oprand_size_mismatch diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index c4603a73177..db50c62b9e9 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -6318,60 +6318,60 @@ lex_got (enum bfd_reloc_code_real *rel, and adjust the reloc according to the real size in reloc(). */ static const struct { const char *str; + int len; const enum bfd_reloc_code_real rel[2]; const i386_operand_type types64; } gotrel[] = { - { "PLTOFF", { _dummy_first_bfd_reloc_code_real, - BFD_RELOC_X86_64_PLTOFF64 }, + { STRING_COMMA_LEN ("PLTOFF"), { _dummy_first_bfd_reloc_code_real, + BFD_RELOC_X86_64_PLTOFF64 }, OPERAND_TYPE_IMM64 }, - { "PLT", { BFD_RELOC_386_PLT32, - BFD_RELOC_X86_64_PLT32 }, + { STRING_COMMA_LEN ("PLT"), { BFD_RELOC_386_PLT32, + BFD_RELOC_X86_64_PLT32 }, OPERAND_TYPE_IMM32_32S_DISP32 }, - { "GOTPLT", { _dummy_first_bfd_reloc_code_real, - BFD_RELOC_X86_64_GOTPLT64 }, + { STRING_COMMA_LEN ("GOTPLT"), { _dummy_first_bfd_reloc_code_real, + BFD_RELOC_X86_64_GOTPLT64 }, OPERAND_TYPE_IMM64_DISP64 }, - { "GOTOFF", { BFD_RELOC_386_GOTOFF, - BFD_RELOC_X86_64_GOTOFF64 }, + { STRING_COMMA_LEN ("GOTOFF"), { BFD_RELOC_386_GOTOFF, + BFD_RELOC_X86_64_GOTOFF64 }, OPERAND_TYPE_IMM64_DISP64 }, - { "GOTPCREL", { _dummy_first_bfd_reloc_code_real, - BFD_RELOC_X86_64_GOTPCREL }, + { STRING_COMMA_LEN ("GOTPCREL"), { _dummy_first_bfd_reloc_code_real, + BFD_RELOC_X86_64_GOTPCREL }, OPERAND_TYPE_IMM32_32S_DISP32 }, - { "TLSGD", { BFD_RELOC_386_TLS_GD, - BFD_RELOC_X86_64_TLSGD }, + { STRING_COMMA_LEN ("TLSGD"), { BFD_RELOC_386_TLS_GD, + BFD_RELOC_X86_64_TLSGD }, OPERAND_TYPE_IMM32_32S_DISP32 }, - { "TLSLDM", { BFD_RELOC_386_TLS_LDM, - _dummy_first_bfd_reloc_code_real }, + { STRING_COMMA_LEN ("TLSLDM"), { BFD_RELOC_386_TLS_LDM, + _dummy_first_bfd_reloc_code_real }, OPERAND_TYPE_NONE }, - { "TLSLD", { _dummy_first_bfd_reloc_code_real, - BFD_RELOC_X86_64_TLSLD }, + { STRING_COMMA_LEN ("TLSLD"), { _dummy_first_bfd_reloc_code_real, + BFD_RELOC_X86_64_TLSLD }, OPERAND_TYPE_IMM32_32S_DISP32 }, - { "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32, - BFD_RELOC_X86_64_GOTTPOFF }, + { STRING_COMMA_LEN ("GOTTPOFF"), { BFD_RELOC_386_TLS_IE_32, + BFD_RELOC_X86_64_GOTTPOFF }, OPERAND_TYPE_IMM32_32S_DISP32 }, - { "TPOFF", { BFD_RELOC_386_TLS_LE_32, - BFD_RELOC_X86_64_TPOFF32 }, + { STRING_COMMA_LEN ("TPOFF"), { BFD_RELOC_386_TLS_LE_32, + BFD_RELOC_X86_64_TPOFF32 }, OPERAND_TYPE_IMM32_32S_64_DISP32_64 }, - { "NTPOFF", { BFD_RELOC_386_TLS_LE, - _dummy_first_bfd_reloc_code_real }, + { STRING_COMMA_LEN ("NTPOFF"), { BFD_RELOC_386_TLS_LE, + _dummy_first_bfd_reloc_code_real }, OPERAND_TYPE_NONE }, - { "DTPOFF", { BFD_RELOC_386_TLS_LDO_32, - BFD_RELOC_X86_64_DTPOFF32 }, - + { STRING_COMMA_LEN ("DTPOFF"), { BFD_RELOC_386_TLS_LDO_32, + BFD_RELOC_X86_64_DTPOFF32 }, OPERAND_TYPE_IMM32_32S_64_DISP32_64 }, - { "GOTNTPOFF",{ BFD_RELOC_386_TLS_GOTIE, - _dummy_first_bfd_reloc_code_real }, + { STRING_COMMA_LEN ("GOTNTPOFF"),{ BFD_RELOC_386_TLS_GOTIE, + _dummy_first_bfd_reloc_code_real }, OPERAND_TYPE_NONE }, - { "INDNTPOFF",{ BFD_RELOC_386_TLS_IE, - _dummy_first_bfd_reloc_code_real }, + { STRING_COMMA_LEN ("INDNTPOFF"),{ BFD_RELOC_386_TLS_IE, + _dummy_first_bfd_reloc_code_real }, OPERAND_TYPE_NONE }, - { "GOT", { BFD_RELOC_386_GOT32, - BFD_RELOC_X86_64_GOT32 }, + { STRING_COMMA_LEN ("GOT"), { BFD_RELOC_386_GOT32, + BFD_RELOC_X86_64_GOT32 }, OPERAND_TYPE_IMM32_32S_64_DISP32 }, - { "TLSDESC", { BFD_RELOC_386_TLS_GOTDESC, - BFD_RELOC_X86_64_GOTPC32_TLSDESC }, + { STRING_COMMA_LEN ("TLSDESC"), { BFD_RELOC_386_TLS_GOTDESC, + BFD_RELOC_X86_64_GOTPC32_TLSDESC }, OPERAND_TYPE_IMM32_32S_DISP32 }, - { "TLSCALL", { BFD_RELOC_386_TLS_DESC_CALL, - BFD_RELOC_X86_64_TLSDESC_CALL }, + { STRING_COMMA_LEN ("TLSCALL"), { BFD_RELOC_386_TLS_DESC_CALL, + BFD_RELOC_X86_64_TLSDESC_CALL }, OPERAND_TYPE_IMM32_32S_DISP32 }, }; char *cp; @@ -6386,9 +6386,7 @@ lex_got (enum bfd_reloc_code_real *rel, for (j = 0; j < ARRAY_SIZE (gotrel); j++) { - int len; - - len = strlen (gotrel[j].str); + int len = gotrel[j].len; if (strncasecmp (cp + 1, gotrel[j].str, len) == 0) { if (gotrel[j].rel[object_64bit] != 0)