Add --size-check=[error|warning].
gas/ 2011-03-16 H.J. Lu <hongjiu.lu@intel.com> * as.c (show_usage): Add --size-check=. (parse_args): Add and handle OPTION_SIZE_CHECK. * as.h (flag_size_check): New. * config/obj-elf.c (elf_frob_symbol): Use as_bad to report bad .size directive only for --size-check=error. * doc/as.texinfo: Document --size-check=. gas/testsuite/ 2011-03-16 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/bad-size.d: New. * gas/i386/bad-size.s: Likewise. * gas/i386/bad-size.warn: Likewise. * gas/i386/i386.exp: Run bad-size for ELF targets.
This commit is contained in:
parent
9a6f1302f0
commit
21be61f588
|
@ -1,3 +1,15 @@
|
||||||
|
2011-03-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* as.c (show_usage): Add --size-check=.
|
||||||
|
(parse_args): Add and handle OPTION_SIZE_CHECK.
|
||||||
|
|
||||||
|
* as.h (flag_size_check): New.
|
||||||
|
|
||||||
|
* config/obj-elf.c (elf_frob_symbol): Use as_bad to report
|
||||||
|
bad .size directive only for --size-check=error.
|
||||||
|
|
||||||
|
* doc/as.texinfo: Document --size-check=.
|
||||||
|
|
||||||
2011-03-14 Mike Frysinger <vapier@gentoo.org>
|
2011-03-14 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* config/tc-bfin.c (bfin_cpus[]): Add 0.4 for
|
* config/tc-bfin.c (bfin_cpus[]): Add 0.4 for
|
||||||
|
|
14
gas/as.c
14
gas/as.c
|
@ -284,6 +284,9 @@ Options:\n\
|
||||||
--execstack require executable stack for this object\n"));
|
--execstack require executable stack for this object\n"));
|
||||||
fprintf (stream, _("\
|
fprintf (stream, _("\
|
||||||
--noexecstack don't require executable stack for this object\n"));
|
--noexecstack don't require executable stack for this object\n"));
|
||||||
|
fprintf (stream, _("\
|
||||||
|
--size-check=[error|warning]\n\
|
||||||
|
ELF .size directive check (default --size-check=error)\n"));
|
||||||
#endif
|
#endif
|
||||||
fprintf (stream, _("\
|
fprintf (stream, _("\
|
||||||
-f skip whitespace and comment preprocessing\n"));
|
-f skip whitespace and comment preprocessing\n"));
|
||||||
|
@ -443,6 +446,7 @@ parse_args (int * pargc, char *** pargv)
|
||||||
OPTION_TARGET_HELP,
|
OPTION_TARGET_HELP,
|
||||||
OPTION_EXECSTACK,
|
OPTION_EXECSTACK,
|
||||||
OPTION_NOEXECSTACK,
|
OPTION_NOEXECSTACK,
|
||||||
|
OPTION_SIZE_CHECK,
|
||||||
OPTION_ALTERNATE,
|
OPTION_ALTERNATE,
|
||||||
OPTION_AL,
|
OPTION_AL,
|
||||||
OPTION_HASH_TABLE_SIZE,
|
OPTION_HASH_TABLE_SIZE,
|
||||||
|
@ -476,6 +480,7 @@ parse_args (int * pargc, char *** pargv)
|
||||||
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
|
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
|
||||||
,{"execstack", no_argument, NULL, OPTION_EXECSTACK}
|
,{"execstack", no_argument, NULL, OPTION_EXECSTACK}
|
||||||
,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}
|
,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}
|
||||||
|
,{"size-check", required_argument, NULL, OPTION_SIZE_CHECK}
|
||||||
#endif
|
#endif
|
||||||
,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
|
,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
|
||||||
,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2}
|
,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2}
|
||||||
|
@ -813,6 +818,15 @@ This program has absolutely no warranty.\n"));
|
||||||
flag_noexecstack = 1;
|
flag_noexecstack = 1;
|
||||||
flag_execstack = 0;
|
flag_execstack = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPTION_SIZE_CHECK:
|
||||||
|
if (strcasecmp (optarg, "error") == 0)
|
||||||
|
flag_size_check = size_check_error;
|
||||||
|
else if (strcasecmp (optarg, "warning") == 0)
|
||||||
|
flag_size_check = size_check_warning;
|
||||||
|
else
|
||||||
|
as_fatal (_("Invalid --size-check= option: `%s'"), optarg);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'Z':
|
case 'Z':
|
||||||
flag_always_generate_output = 1;
|
flag_always_generate_output = 1;
|
||||||
|
|
10
gas/as.h
10
gas/as.h
|
@ -575,6 +575,16 @@ COMMON unsigned int found_comment;
|
||||||
COMMON char * found_comment_file;
|
COMMON char * found_comment_file;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
|
||||||
|
/* If .size directive failure should be error or warning. */
|
||||||
|
COMMON enum
|
||||||
|
{
|
||||||
|
size_check_error = 0,
|
||||||
|
size_check_warning
|
||||||
|
}
|
||||||
|
flag_size_check;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DOLLAR_AMBIGU
|
#ifndef DOLLAR_AMBIGU
|
||||||
#define DOLLAR_AMBIGU 0
|
#define DOLLAR_AMBIGU 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1898,6 +1898,12 @@ elf_frob_symbol (symbolS *symp, int *puntp)
|
||||||
{
|
{
|
||||||
const char *op_name = NULL;
|
const char *op_name = NULL;
|
||||||
const char *add_name = NULL;
|
const char *add_name = NULL;
|
||||||
|
PRINTF_LIKE ((*as_error));
|
||||||
|
|
||||||
|
if (flag_size_check == size_check_error)
|
||||||
|
as_error = as_bad;
|
||||||
|
else
|
||||||
|
as_error = as_warn;
|
||||||
|
|
||||||
if (size->X_op == O_subtract)
|
if (size->X_op == O_subtract)
|
||||||
{
|
{
|
||||||
|
@ -1909,9 +1915,9 @@ elf_frob_symbol (symbolS *symp, int *puntp)
|
||||||
add_name = NULL;
|
add_name = NULL;
|
||||||
|
|
||||||
if (op_name && add_name)
|
if (op_name && add_name)
|
||||||
as_bad (_(".size expression with symbols `%s' and `%s' "
|
as_error (_(".size expression with symbols `%s' and "
|
||||||
"does not evaluate to a constant"),
|
"`%s' does not evaluate to a constant"),
|
||||||
op_name, add_name);
|
op_name, add_name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -1924,13 +1930,15 @@ elf_frob_symbol (symbolS *symp, int *puntp)
|
||||||
name = NULL;
|
name = NULL;
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
as_bad (_(".size expression with symbol `%s' "
|
as_error (_(".size expression with symbol `%s' "
|
||||||
"does not evaluate to a constant"), name);
|
"does not evaluate to a constant"),
|
||||||
|
name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!op_name && !add_name)
|
if (!op_name && !add_name)
|
||||||
as_bad (_(".size expression does not evaluate to a constant"));
|
as_error (_(".size expression does not evaluate to a "
|
||||||
|
"constant"));
|
||||||
}
|
}
|
||||||
free (sy_obj->size);
|
free (sy_obj->size);
|
||||||
sy_obj->size = NULL;
|
sy_obj->size = NULL;
|
||||||
|
|
|
@ -243,6 +243,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
|
||||||
@var{objfile}] [@b{-R}] [@b{--reduce-memory-overheads}] [@b{--statistics}]
|
@var{objfile}] [@b{-R}] [@b{--reduce-memory-overheads}] [@b{--statistics}]
|
||||||
[@b{-v}] [@b{-version}] [@b{--version}] [@b{-W}] [@b{--warn}]
|
[@b{-v}] [@b{-version}] [@b{--version}] [@b{-W}] [@b{--warn}]
|
||||||
[@b{--fatal-warnings}] [@b{-w}] [@b{-x}] [@b{-Z}] [@b{@@@var{FILE}}]
|
[@b{--fatal-warnings}] [@b{-w}] [@b{-x}] [@b{-Z}] [@b{@@@var{FILE}}]
|
||||||
|
[@b{--size-check=[error|warning]}]
|
||||||
[@b{--target-help}] [@var{target-options}]
|
[@b{--target-help}] [@var{target-options}]
|
||||||
[@b{--}|@var{files} @dots{}]
|
[@b{--}|@var{files} @dots{}]
|
||||||
@c
|
@c
|
||||||
|
@ -611,6 +612,10 @@ Generate DWARF2 debugging information for each assembler line. This
|
||||||
may help debugging assembler code, if the debugger can handle it. Note---this
|
may help debugging assembler code, if the debugger can handle it. Note---this
|
||||||
option is only supported by some targets, not all of them.
|
option is only supported by some targets, not all of them.
|
||||||
|
|
||||||
|
@item --size-check=error
|
||||||
|
@itemx --size-check=warning
|
||||||
|
Issue an error or warning for invalid ELF .size directive.
|
||||||
|
|
||||||
@item --help
|
@item --help
|
||||||
Print a summary of the command line options and exit.
|
Print a summary of the command line options and exit.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2011-03-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* gas/i386/bad-size.d: New.
|
||||||
|
* gas/i386/bad-size.s: Likewise.
|
||||||
|
* gas/i386/bad-size.warn: Likewise.
|
||||||
|
|
||||||
|
* gas/i386/i386.exp: Run bad-size for ELF targets.
|
||||||
|
|
||||||
2011-03-06 H.J. Lu <hongjiu.lu@intel.com>
|
2011-03-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* gas/elf/bad-size.err: Revert the last change.
|
* gas/elf/bad-size.err: Revert the last change.
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#as: --size-check=warning
|
||||||
|
#objdump: -dw
|
||||||
|
#name: Check bad size directive
|
||||||
|
#error-output: bad-size.warn
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
0+ <_test_nop>:
|
||||||
|
[ ]*[a-f0-9]+: 90 nop
|
||||||
|
|
||||||
|
Disassembly of section .text.entry.continue:
|
||||||
|
|
||||||
|
0+ <.text.entry.continue>:
|
||||||
|
[ ]*[a-f0-9]+: 90 nop
|
||||||
|
#pass
|
|
@ -0,0 +1,6 @@
|
||||||
|
.text
|
||||||
|
_test_nop:
|
||||||
|
nop
|
||||||
|
.section .text.entry.continue, "xa"
|
||||||
|
nop
|
||||||
|
.size _test_nop, .-_test_nop
|
|
@ -0,0 +1,2 @@
|
||||||
|
.*bad-size\.s: Assembler messages:
|
||||||
|
.*bad-size\.s:6: Warning: .*
|
|
@ -228,6 +228,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
|
||||||
run_dump_test "debug1"
|
run_dump_test "debug1"
|
||||||
|
|
||||||
run_dump_test "dw2-compress-2"
|
run_dump_test "dw2-compress-2"
|
||||||
|
|
||||||
|
run_dump_test "bad-size"
|
||||||
}
|
}
|
||||||
|
|
||||||
# This is a PE specific test.
|
# This is a PE specific test.
|
||||||
|
|
Loading…
Reference in New Issue