Commit Graph

969 Commits

Author SHA1 Message Date
Manuel López-Ibáñez 97aa8bb6e2 diagnostic.c (diagnostic_color_init): New.
gcc/ChangeLog:

2014-12-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* diagnostic.c (diagnostic_color_init): New.
	* diagnostic.h: Declare.
	* gcc.c (driver::global_initializations): Use it.
	(driver_handle_option): Handle -fdiagnostics-color_.
	* toplev.c: Do not include diagnostic-color.h.
	(process_options): Do not initialize color diagnostics here.
	* common.opt (fdiagnostics-color=): Add Driver.
	* opts-global.c (init_options_once): Initialize color here.
	* opts.c (common_handle_option): Use diagnostics_color_init.
	* diagnostic-color.h: Fix comment.

From-SVN: r218406
2014-12-04 23:09:41 +00:00
Jakub Jelinek 4bb0ca2d1e gcc.c (SANITIZER_SPEC): Don't error on -fsanitize=thread without -pie or -shared...
* gcc.c (SANITIZER_SPEC): Don't error on -fsanitize=thread
	without -pie or -shared, error on -fsanitize=thread -static instead.

	* lib/tsan-dg.exp (check_effective_target_fsanitize_thread,
	tsan_init): Don't use -fPIE or -pie.

From-SVN: r218097
2014-11-26 20:54:49 +01:00
Ilya Tocar 191ec64036 Remove unnecessary calls to strchr.
gcc/
	* gcc.c (handle_foffload_option): Remove unnecessary calls to strchr,
	strlen, strncpy.
	* lto-wrapper.c (append_offload_options): Likewise.


Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r218044
2014-11-25 16:56:03 +03:00
Manuel López-Ibáñez 92c66d8311 re PR driver/36312 (should refuse to overwrite input file with output file)
PR driver/36312
	PR driver/63837
	* gcc.c (process_command): Don't check for input/output
	filename equality if output is HOST_BIT_BUCKET.
	* toplev.c (init_asm_output): Likewise.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r217789
2014-11-19 19:11:54 +01:00
Dominique d'Humieres b08dec2fb2 re PR bootstrap/63853 (The use of strchrnul breaks bootstrap on x86_64-apple-darwin14.)
2014-11-13  Dominique Dhumieres  <dominiq@lps.ens.fr>

	PR bootstrap/63853
gcc/
	* gcc.c (handle_foffload_option): Replace strchrnul with strchr.
	* lto-wrapper.c (parse_env_var, append_offload_options): Likewise.

From-SVN: r217524
2014-11-13 22:06:15 +00:00
Bernd Schmidt c713ddc031 [PATCH 6/7] OpenMP 4.0 offloading infrastructure: option handling.
gcc/
	* common.opt (foffload, foffload-abi): New options.
	* config/i386/i386.c (ix86_offload_options): New static function.
	(TARGET_OFFLOAD_OPTIONS): Define.
	* coretypes.h (enum offload_abi): New enum.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in (TARGET_OFFLOAD_OPTIONS): Document.
	* gcc.c (offload_targets): New static variable.
	(handle_foffload_option): New static function.
	(driver_handle_option): Handle OPT_foffload_.
	(driver::maybe_putenv_OFFLOAD_TARGETS): Set OFFLOAD_TARGET_NAMES
	according to offload_targets.
	* hooks.c (hook_charptr_void_null): New hook.
	* hooks.h (hook_charptr_void_null): Declare.
	* lto-opts.c: Include lto-section-names.h.
	(lto_write_options): Append options from target offload_options hook and
	store them to offload_lto section.  Do not store target-specific,
	driver and diagnostic options in offload_lto section.
	* lto-wrapper.c (merge_and_complain): Handle OPT_foffload_ and
	OPT_foffload_abi_.
	(append_compiler_options, append_linker_options)
	(append_offload_options): New static functions.
	(compile_offload_image): Add new arguments with options.
	Call append_compiler_options and append_offload_options.
	(compile_images_for_offload_targets): Add new arguments with options.
	(find_and_merge_options): New static function.
	(run_gcc): Outline options handling into the new functions:
	find_and_merge_options, append_compiler_options, append_linker_options.
	* opts.c (common_handle_option): Don't handle OPT_foffload_.
	Forbid OPT_foffload_abi_ for non-offload compiler.
	* target.def (offload_options): New target hook.

Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>

From-SVN: r217493
2014-11-13 13:54:07 +00:00
Ilya Verbin fc8b3540d2 [PATCH 4/7] OpenMP 4.0 offloading infrastructure: lto-wrapper.
gcc/
	* gcc.c (spec_host_machine, accel_dir_suffix): New variables.
	(process_command): Tweak path construction for the possibility
	of being configured as an offload compiler.
	(driver::maybe_putenv_OFFLOAD_TARGETS): New function.
	(driver::main): Call maybe_putenv_OFFLOAD_TARGETS.
	(driver::set_up_specs): Tweak path construction for the possibility of
	being configured as an offload compiler.
	* lto-wrapper.c (OFFLOAD_TARGET_NAMES_ENV): Define.
	(offload_names, offloadbegin, offloadend): New static variables.
	(free_array_of_ptrs, parse_env_var, access_check, compile_offload_image)
	(compile_images_for_offload_targets, copy_file, find_offloadbeginend):
	New static functions.
	(run_gcc): Determine whether offload sections are present.  If so, run
	compile_images_for_offload_targets and return the names of new generated
	objects to linker.  If there are offload sections, but no LTO sections,
	then return the copies of input objects without link-time recompilation.

lto-plugin/
	* lto-plugin.c (OFFLOAD_SECTION, OFFLOAD_SECTION_LEN): Define.
	(struct plugin_objfile): Add new field "offload".
	(process_offload_section): New static function.
	(claim_file_handler): Claim file if it contains offload sections.

Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>

From-SVN: r217491
2014-11-13 13:47:46 +00:00
Anthony Brandon 3d00119cfb re PR driver/36312 (should refuse to overwrite input file with output file)
gcc/testsuite/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* gcc.misc-tests/output.exp: New test case for identical input and
	output files.

include/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* diagnostic-core.h: Add prototype for fatal_error.
	* diagnostic.c (fatal_error): New function fatal_error.
	* gcc.c (store_arg): Remove have_o_argbuf_index.
	(process_command): Check if input and output files are the same.
	* toplev.c (init_asm_output): Check if input and output files are
	the same.

libiberty/ChangeLog:

2014-11-11  Anthony Brandon  <anthony.brandon@gmail.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR driver/36312
	* filename_cmp.c (canonical_filename_eq): New function to check if
	file names are the same.
	* functions.texi: Updated with documentation for new function.

Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r217391
2014-11-11 23:33:25 +00:00
Manuel López-Ibáñez 10a241382b Revert revision 217149 because it breaks Ada:
gcc/testsuite/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * gcc.misc-tests/output.exp: New test case for identical input and
        output files.

include/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * diagnostic-core.h: Add prototype for fatal_error.
        * diagnostic.c (fatal_error): New function fatal_error.
        * gcc.c (store_arg): Remove have_o_argbuf_index.
        (process_command): Check if input and output files are the same.
        * toplev.c (init_asm_output): Check if input and output files are
        the same.

libiberty/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

        PR driver/36312
        * filename_cmp.c (canonical_filename_eq): New function to check if
        file names are the same.
        * functions.texi: Updated with documentation for new function.

From-SVN: r217159
2014-11-05 22:17:22 +00:00
Anthony Brandon 9c7a77fcc3 re PR driver/36312 (should refuse to overwrite input file with output file)
gcc/testsuite/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* gcc.misc-tests/output.exp: New test case for identical input and
	output files.

include/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* diagnostic-core.h: Add prototype for fatal_error.
	* diagnostic.c (fatal_error): New function fatal_error.
	* gcc.c (store_arg): Remove have_o_argbuf_index.
	(process_command): Check if input and output files are the same.
	* toplev.c (init_asm_output): Check if input and output files are
	the same.

libiberty/ChangeLog:

2014-11-05  Anthony Brandon  <anthony.brandon@gmail.com>

	PR driver/36312
	* filename_cmp.c (canonical_filename_eq): New function to check if
	file names are the same.
	* functions.texi: Updated with documentation for new function.

From-SVN: r217149
2014-11-05 17:23:46 +00:00
Richard Biener d8857ac603 re PR lto/63603 (Linking with -fno-lto still invokes LTO)
2014-10-22  Richard Biener  <rguenther@suse.de>
            Tobias Burnus <burnus@net-b.de>

        PR lto/63603
        * gcc.c (LINK_COMMAND_SPEC): Add %{fno-lto}.


Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r216566
2014-10-22 22:51:00 +02:00
David Malcolm acbb0489b6 Fix build breakage on darwin introduced by me in r215861
gcc/ChangeLog:
	* gcc.c	(driver::global_initializations): Remove "const" so
	that GCC_DRIVER_HOST_INITIALIZATION can modify decoded_options
	and decoded_options_count.

From-SVN: r215877
2014-10-03 20:25:30 +00:00
David Malcolm 742a072ad0 gcc.c: Split up the driver's "main" into smaller functions
gcc/ChangeLog:
	* gcc.c (class driver): New class.
	(main): Reimplement in terms of driver::main, moving most of the
	locals to be locals within individual methods of class driver.
	The remaining locals "explicit_link_files", "decoded_options" and
	"decoded_options_count" are used by multiple driver:: methods, and
	so become member data.  Doing so isolates the argc/argv reads and
	writes.  Replace "goto out" with a special exit code from
	new method driver::prepare_infiles.  Split out the old
	implementation of main into the following...
	(driver::main): New function, corresponding to the old "main"
	implementation.
	(driver::set_progname): New function, taken from the old
	"main" implementation.
	(driver::expand_at_files): Likewise.
	(driver::decode_argv): Likewise.
	(driver::global_initializations): Likewise.
	(driver::build_multilib_strings): Likewise.
	(driver::set_up_specs): Likewise.
	(driver::putenv_COLLECT_GCC): Likewise.
	(driver::maybe_putenv_COLLECT_LTO_WRAPPER): Likewise.
	(driver::handle_unrecognized_options): Likewise.
	(driver::maybe_print_and_exit): Likewise.
	(driver::prepare_infiles): Likewise.
	(driver::do_spec_on_infiles): Likewise.
	(driver::maybe_run_linker): Likewise.
	(driver::final_actions): Likewise.
	(driver::get_exit_code): Likewise.

From-SVN: r215861
2014-10-03 16:28:03 +00:00
Thomas Schwinge 1120a85052 Fix -freport-bug patch.
gcc/
	* gcc.c (try_generate_repro): Remove argument "prog".  Change all
	users.
	(run_attempt): Handle errors of "pex_run" invocation.

Fixes bootstrap failure/compiler warnings:

    [...]
    ../../master/gcc/gcc.c: In function 'attempt_status run_attempt(const char**, const char*, const char*, int, int)':
    ../../master/gcc/gcc.c:6319:15: error: variable 'errmsg' set but not used [-Werror=unused-but-set-variable]
       const char *errmsg;
                   ^
    ../../master/gcc/gcc.c: At global scope:
    ../../master/gcc/gcc.c:6412:33: error: unused parameter 'prog' [-Werror=unused-parameter]
     try_generate_repro (const char *prog, const char **argv)
                                     ^
    cc1plus: all warnings being treated as errors
    Makefile:1040: recipe for target 'gcc.o' failed
    make[3]: *** [gcc.o] Error 1
    make[3]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build/gcc'
    Makefile:4285: recipe for target 'all-stage2-gcc' failed
    make[2]: *** [all-stage2-gcc] Error 2
    make[2]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
    Makefile:21561: recipe for target 'stage2-bubble' failed
    make[1]: *** [stage2-bubble] Error 2
    make[1]: Leaving directory '/media/erich/home/thomas/tmp/gcc/hurd/master.build'
    Makefile:892: recipe for target 'all' failed
    make: *** [all] Error 2

From-SVN: r215644
2014-09-26 15:43:34 +02:00
Jakub Jelinek dc10fd963f common.opt: New option.
gcc/

2014-09-26  Jakub Jelinek  <jakub@redhat.com>
	    Max Ostapenko  <m.ostapenko@partner.samsung.com>

	* common.opt: New option.
	* doc/invoke.texi: Describe new option.
	* gcc.c (execute): Don't free first string early, but at the end
	of the function.  Call retry_ice if compiler exited with
	ICE_EXIT_CODE.
	(main): Factor out common code.
	(print_configuration): New function.
	(files_equal_p): Likewise.
	(check_repro): Likewise.
	(run_attempt): Likewise.
	(do_report_bug): Likewise.
	(append_text): Likewise.
	(try_generate_repro): Likewise

Co-Authored-By: Max Ostapenko <m.ostapenko@partner.samsung.com>

From-SVN: r215633
2014-09-26 11:03:09 +03:00
Jakub Jelinek d30c76701b gnu-user.h (LIBLSAN_EARLY_SPEC): Define.
* config/gnu-user.h (LIBLSAN_EARLY_SPEC): Define.
	* gcc.c (LIBLSAN_SPEC, LIBLSAN_EARLY_SPEC): Follow LIBTSAN*_SPEC.
	(SANITIZER_EARLY_SPEC): Include LIBLSAN_EARLY_SPEC for -fsanitize=leak.

From-SVN: r214778
2014-09-01 10:26:51 +02:00
Chen Gang e3cb8f057f * gcc.c (do_spec_1): Allocate enough space for saved_suffix.
From-SVN: r213387
2014-07-31 16:31:39 -06:00
Yury Gribov fec4842dee cpp.texi (__SANITIZE_ADDRESS__): Updated description.
2014-07-31  Yury Gribov  <y.gribov@samsung.com>

	* doc/cpp.texi (__SANITIZE_ADDRESS__): Updated description.
	* doc/invoke.texi (-fsanitize=kernel-address): Describe new option.
	* flag-types.h (SANITIZE_USER_ADDRESS, SANITIZE_KERNEL_ADDRESS):
	New enums.
	* gcc.c (sanitize_spec_function): Support new option.
	(SANITIZER_SPEC): Remove now redundant check.
	* opts.c (common_handle_option): Support new option.
	(finish_options): Check for incompatibilities.
	* toplev.c (process_options): Split userspace-specific checks.

From-SVN: r213367
2014-07-31 13:35:18 +00:00
Rainer Orth 29d7cbd1b9 Support compressed debug sections
* configure.ac (gcc_cv_as_compress_debug): Check for assembler
	compressed debug support.
	(gcc_cv_ld_compress_debug): Check for linker compressed debug
	support.
	* configure: Regenerate.
	* config.in: Regenerate.
	* common.opt (compressed_debug_sections): New enum.
	(gz, gz=): New options.
	* gcc.c (LINK_COMPRESS_DEBUG_SPEC, ASM_COMPRESS_DEBUG_SPEC):
	Define.
	(LINK_COMMAND_SPEC): Invoke LINK_COMPRESS_DEBUG_SPEC.
	(asm_options): Invoke ASM_COMPRESS_DEBUG_SPEC.
	* config/darwin.h (LINK_COMMAND_SPEC_A): Invoke
	LINK_COMPRESS_DEBUG_SPEC.
	* config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise.
	* opts.c (common_handle_option): Handle OPT_gz, OPT_gz_.
	* doc/invoke.texi (Option Summary, Debugging Options): Add
	-gz[=type].
	(Debugging Options): Document -gz[=type].

From-SVN: r212072
2014-06-27 13:48:54 +00:00
Paul Gortmaker 646d1beda0 gcc.c (set_multilib_dir): Malloc "." pointer as well.
2014-06-25  Paul Gortmaker  <paul.gortmaker@windriver.com>
            Jakub Jelinek  <jakub@redhat.com>

        * gcc.c (set_multilib_dir): Malloc "." pointer as well.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r211997
2014-06-25 15:21:12 -06:00
Jeff Law 3c40bd655e Revert "2014-06-23 Paul Gortmaker <paul.gortmaker@windriver.com>"
This reverts commit ed8c02da028fb10d25a682e1838ba8b23a2c34ff.

From-SVN: r211915
2014-06-23 14:31:52 -06:00
Paul Gortmaker 82ec440684 gcc.c (set_multilib_dir): Fix typo.
2014-06-23  Paul Gortmaker  <paul.gortmaker@windriver.com>

        * gcc.c (set_multilib_dir): Fix typo.

From-SVN: r211911
2014-06-23 12:51:36 -06:00
Marek Polacek 85a16bf8b5 builtins.def: Change SANITIZE_FLOAT_DIVIDE to SANITIZE_NONDEFAULT.
* builtins.def: Change SANITIZE_FLOAT_DIVIDE to SANITIZE_NONDEFAULT.
	* gcc.c (sanitize_spec_function): Likewise.
	* convert.c (convert_to_integer): Include "ubsan.h".  Add
	floating-point to integer instrumentation.
	* doc/invoke.texi: Document -fsanitize=float-cast-overflow.
	* flag-types.h (enum sanitize_code): Add SANITIZE_FLOAT_CAST and
	SANITIZE_NONDEFAULT.
	* opts.c (common_handle_option): Handle -fsanitize=float-cast-overflow.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW,
	BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW_ABORT): Add.
	* ubsan.c: Include "realmpfr.h" and "dfp.h".
	(get_ubsan_type_info_for_type): Handle REAL_TYPEs.
	(ubsan_type_descriptor): Set tkind to 0xffff for types other than
	float/double/long double.
	(ubsan_instrument_float_cast): New function.
	* ubsan.h (ubsan_instrument_float_cast): Declare.
testsuite/
	* c-c++-common/ubsan/float-cast-overflow-1.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-10.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-2.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-3.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-4.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-5.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-6.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-7.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-7.h: New file.
	* c-c++-common/ubsan/float-cast-overflow-8.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-9.c: New test.
	* c-c++-common/ubsan/float-cast.h: New file.
	* g++.dg/ubsan/float-cast-overflow-bf.C: New test.
	* gcc.dg/ubsan/float-cast-overflow-bf.c: New test.
libsanitizer/
	* ubsan/ubsan_value.cc (getFloatValue): Handle 96-bit
	floating-point types.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r210862
2014-05-23 14:44:42 +00:00
Marek Polacek f8ed5150c3 gcc.c (sanitize_spec_function): Handle SANITIZE_FLOAT_DIVIDE.
* gcc.c (sanitize_spec_function): Handle SANITIZE_FLOAT_DIVIDE.
	* builtins.def: Initialize builtins even for SANITIZE_FLOAT_DIVIDE.
	* flag-types.h (enum sanitize_code): Add SANITIZE_FLOAT_DIVIDE.
	* opts.c (common_handle_option): Add -fsanitize=float-divide-by-zero.
c-family/
	* c-ubsan.c (ubsan_instrument_division): Handle REAL_TYPEs.  Perform
	INT_MIN / -1 sanitization only for integer types.
c/
	* c-typeck.c (build_binary_op): Call ubsan_instrument_division
	also when SANITIZE_FLOAT_DIVIDE is on.
cp/
	* typeck.c (cp_build_binary_op): Call ubsan_instrument_division
	even when SANITIZE_FLOAT_DIVIDE is on.  Set doing_div_or_mod even
	for non-integer types.
testsuite/
	* c-c++-common/ubsan/div-by-zero-5.c: Fix formatting.
	* c-c++-common/ubsan/float-div-by-zero-1.c: New test.

From-SVN: r209927
2014-04-30 07:34:43 +00:00
Jakub Jelinek 1c33c9b70c re PR sanitizer/60275 ([UBSAN] Add -f[no-]sanitize-recover/-fsanitize-undefined-trap-on-error to make UBSAN's runtime errors fatal)
PR sanitizer/60275
	* common.opt (fsanitize-recover, fsanitize-undefined-trap-on-error):
	New options.
	* gcc.c (sanitize_spec_function): Don't return "" for "undefined"
	if flag_sanitize_undefined_trap_on_error.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_DIVREM_OVERFLOW_ABORT,
	BUILT_IN_UBSAN_HANDLE_SHIFT_OUT_OF_BOUNDS_ABORT,
	BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE_ABORT,
	BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
	BUILT_IN_UBSAN_HANDLE_ADD_OVERFLOW_ABORT,
	BUILT_IN_UBSAN_HANDLE_SUB_OVERFLOW_ABORT,
	BUILT_IN_UBSAN_HANDLE_MUL_OVERFLOW_ABORT,
	BUILT_IN_UBSAN_HANDLE_NEGATE_OVERFLOW_ABORT,
	BUILT_IN_UBSAN_HANDLE_LOAD_INVALID_VALUE_ABORT): New builtins.
	* ubsan.c (ubsan_instrument_unreachable): Return
	__builtin_trap () if flag_sanitize_undefined_trap_on_error.
	(ubsan_expand_null_ifn): Emit __builtin_trap ()
	if flag_sanitize_undefined_trap_on_error and
	__ubsan_handle_type_mismatch_abort if !flag_sanitize_recover.
	(ubsan_expand_null_ifn, ubsan_build_overflow_builtin,
	instrument_bool_enum_load): Emit __builtin_trap () if
	flag_sanitize_undefined_trap_on_error and
	__builtin_handle_*_abort () if !flag_sanitize_recover.
	* doc/invoke.texi (-fsanitize-recover,
	-fsanitize-undefined-trap-on-error): Document.
c-family/
	* c-ubsan.c (ubsan_instrument_return): Return __builtin_trap ()
	if flag_sanitize_undefined_trap_on_error.
	(ubsan_instrument_division, ubsan_instrument_shift,
	ubsan_instrument_vla): Likewise.  Use __ubsan_handle_*_abort ()
	if !flag_sanitize_recover.
testsuite/
	* g++.dg/ubsan/return-2.C: Revert 2014-03-24 changes, add
	-fno-sanitize-recover to dg-options.
	* g++.dg/ubsan/cxx11-shift-1.C: Remove c++11 target restriction,
	add -std=c++11 to dg-options.
	* g++.dg/ubsan/cxx11-shift-2.C: Likewise.
	* g++.dg/ubsan/cxx1y-vla.C: Remove c++1y target restriction,
	add -std=c++1y to dg-options.
	* c-c++-common/ubsan/undefined-1.c: Revert 2014-03-24 changes, add
	-fno-sanitize-recover to dg-options.
	* c-c++-common/ubsan/overflow-sub-1.c: Likewise.
	* c-c++-common/ubsan/vla-4.c: Likewise.
	* c-c++-common/ubsan/pr59503.c: Likewise.
	* c-c++-common/ubsan/vla-3.c: Likewise.
	* c-c++-common/ubsan/save-expr-1.c: Likewise.
	* c-c++-common/ubsan/overflow-add-1.c: Likewise.
	* c-c++-common/ubsan/shift-3.c: Likewise.
	* c-c++-common/ubsan/overflow-1.c: Likewise.
	* c-c++-common/ubsan/overflow-negate-2.c: Likewise.
	* c-c++-common/ubsan/vla-2.c: Likewise.
	* c-c++-common/ubsan/overflow-mul-1.c: Likewise.
	* c-c++-common/ubsan/pr60613-1.c: Likewise.
	* c-c++-common/ubsan/shift-6.c: Likewise.
	* c-c++-common/ubsan/overflow-mul-3.c: Likewise.
	* c-c++-common/ubsan/overflow-add-3.c: New test.
	* c-c++-common/ubsan/overflow-add-4.c: New test.
	* c-c++-common/ubsan/div-by-zero-6.c: New test.
	* c-c++-common/ubsan/div-by-zero-7.c: New test.

From-SVN: r209672
2014-04-23 10:20:12 +02:00
Kito Cheng 59b266b1d7 * gcc.c (used_arg): Prevent out of bound access for multilib_options.
From-SVN: r209470
2014-04-17 11:01:22 +02:00
Tobias Burnus b9487dd868 gcc.c (LINK_COMMAND_SPEC): Use libcilkrts.spec for -fcilkplus.
gcc/
2014-03-26  Tobias Burnus  <burnus@net-b.de>

        * gcc.c (LINK_COMMAND_SPEC): Use libcilkrts.spec for -fcilkplus.
        (CILK_SELF_SPECS): New define.
        (driver_self_specs): Use it.

libcilkrts/
2014-03-26  Tobias Burnus  <burnus@net-b.de>

        * libcilkrts.spec.in: New.
        * Makefile.am: Handle libcilkrts.spec.
        * configure.ac: Determine link options for libcilkrts.spec.
        * Makefile.in: Regenerate.
        * configure: Regenerate.
        * aclocal.m4: Regenerate.

From-SVN: r208847
2014-03-26 20:16:35 +01:00
Eric Botcazou f87604f8d2 re PR rtl-optimization/60601 (profiledbootstrap fails with Ada)
PR rtl-optimization/60601
	* bb-reorder.c (fix_up_fall_thru_edges): Test EDGE_FALLTHRU everywhere.

	* gcc.c (eval_spec_function): Initialize save_growing_value.

From-SVN: r208770
2014-03-23 11:29:42 +00:00
Richard Biener f3ba16d058 gcc.c (PLUGIN_COND): Always enable unless -fno-use-linker-plugin or -fno-lto is specified and the...
2014-03-06  Richard Biener  <rguenther@suse.de>

	* gcc.c (PLUGIN_COND): Always enable unless -fno-use-linker-plugin
	or -fno-lto is specified and the linker has full plugin support.
	* collect2.c (lto_mode): Default to LTO_MODE_WHOPR if LTO is
	enabled.
	(main): Remove -flto processing, adjust lto_mode using
	use_plugin late.
	* lto-wrapper.c (merge_and_complain): Merge compile-time
	optimization levels.
	(run_gcc): And pass it through to the link options.

From-SVN: r208375
2014-03-06 08:48:01 +00:00
Jan Hubicka f300e7b88c lto-cgraph.c (asm_nodes_output): Make global.
* lto-cgraph.c (asm_nodes_output): Make global.
	* lto-wrapper.c (run_gcc): Pass down paralelizm to WPA.
	* gcc.c (AS_NEEDS_DASH_FOR_PIPED_INPUT): Allow WPA
	parameter
	(driver_handle_option): Handle OPT_fwpa.

	* lto.c (lto_parallelism): New static var.
	(do_stream_out, wait_for_child, stream_out): New static functions.
	(lto_wpa_write_files): Add support for parallel streaming.
	(do_whole_program_analysis): Set parallelism.
	* lang.opt (fwpa): Add parameter.
	* lto-lang.c (lto_handle_option): Handle flag_wpa.
	(lto_init): Update use of flag_wpa.
	* lto-streamer.h (asm_nodes_output): Declare.

From-SVN: r207515
2014-02-05 17:21:07 +00:00
Tobias Burnus 98db73df84 gnat_ugn.texi: Bump @copying's copyright year.
2014-01-02  Tobias Burnus  <burnus@net-b.de>

gcc/ada/
        * gnat_ugn.texi: Bump @copying's copyright year.

gcc/
        * gcc.c (process_command): Update copyright notice dates.
        * gcov-dump.c: Ditto.
        * gcov.c: Ditto.
        * doc/cpp.texi: Bump @copying's copyright year.
        * doc/cppinternals.texi: Ditto.
        * doc/gcc.texi: Ditto.
        * doc/gccint.texi: Ditto.
        * doc/gcov.texi: Ditto.
        * doc/install.texi: Ditto.
        * doc/invoke.texi: Ditto.

gcc/fortran/
        * gfortranspec.c (lang_specific_driver): Update copyright notice
        dates.
        * gfc-internals.texi: Bump @copying's copyright year.
        * gfortran.texi: Ditto.
        * intrinsic.texi: Ditto.
        * invoke.texi: Ditto.

gcc/go/
        * gcc/go/gccgo.texi: Ditto.

gcc/java/
        * jcf-dump.c (version): Update copyright notice dates.
        * gcj.texi: Bump @copying's copyright year.

libgomp/
        * libgomp.texi: Bump @copying's copyright year.

libitm/
        * libitm.texi: Bump @copying's copyright year.

libjava/
        * classpath/gnu/java/rmi/registry/RegistryImpl.java (version):
        * Update
        copyright notice dates.
        * classpath/tools/gnu/classpath/tools/orbd/Main.java (run):
        * Ditto.
        * gnu/gcj/convert/Convert.java (version): Update copyright
        * notice
        dates.
        * gnu/gcj/tools/gcj_dbtool/Main.java (main): Ditto.

libquadmath/
        * libquadmath.texi: Bump @copying's copyright year.

From-SVN: r206286
2014-01-02 22:25:41 +01:00
H.J. Lu b78e932d51 Improve -fuse-ld=[bfd|gold] check
PR driver/59321
	* collect2.c (main): Check -fuse-ld=[bfd|gold] when
	DEFAULT_LINKER is defined.
	* common.opt (fuse-ld=bfd): Add Driver.
	(fuse-ld=gold): Likewise.
	* gcc.c (use_ld): New variable.
	(driver_handle_option): Set use_ld for OPT_fuse_ld_bfd and
	OPT_fuse_ld_gold.
	(main): Check -fuse-ld=[bfd|gold] for -print-prog-name=ld.

From-SVN: r206129
2013-12-19 10:11:42 -08:00
Jakub Jelinek 35814b0346 re PR sanitizer/59063 (ASAN: segfault in __interceptor_clock_gettime)
gcc/
2013-11-29  Jakub Jelinek  <jakub@redhat.com>
            Yury Gribov  <y.gribov@samsung.com>

        PR sanitizer/59063
        * config/gnu-user.h: Removed old code for setting up sanitizer
        libs.
        * gcc.c: Using libsanitizer spec instead of explicit libs.

gcc/testsuite/
2013-11-29  Jakub Jelinek  <jakub@redhat.com>
            Yury Gribov  <y.gribov@samsung.com>

        PR sanitizer/59063
        * c-c++-common/asan/pr59063-1.c: New test.
        * c-c++-common/asan/pr59063-2.c: Likewise.
        * lib/asan-dg.exp: Add path to libsanitizer.spec to cflags.
        * lib/ubsan-dg.exp: Likewise.

libsanitizer/
2013-11-29  Jakub Jelinek  <jakub@redhat.com>
            Yury Gribov  <y.gribov@samsung.com>

        PR sanitizer/59063
        * libsanitizer.spec.in: Add spec file to hold link flags for
        various sanitizer libs.
        * configure.ac: Check whether clock_* routines come from librt.
        * asan/Makefile.am (libasan_la_LDFLAGS): Libs now come from
        configure.ac.
        * tsan/Makefile.am (libtsan_la_LDFLAGS): Likewise.
        * ubsan/Makefile.am (libubsan_la_LDFLAGS): Likewise.
        * lsan/Makefile.am (liblsan_la_LDFLAGS): Likewise.
        * asan/Makefile.in: Regenerate.
        * interception/Makefile.in: Regenerate.
        * lsan/Makefile.in: Regenerate.
        * sanitizer_common/Makefile.in: Regenerate.
        * tsan/Makefile.in: Regenerate.
        * ubsan/Makefile.in: Regenerate.
        * Makefile.in: Regenerate.
        * configure: Regenerate.


Co-Authored-By: Yury Gribov <y.gribov@samsung.com>

From-SVN: r205524
2013-11-29 12:30:36 +00:00
Jakub Jelinek 9065ada9b5 re PR sanitizer/59061 (Port leaksanitizer)
PR sanitizer/59061
	* common.opt (static-liblsan): Add.
	* config/gnu-user.h (STATIC_LIBLSAN_LIBS, STATIC_LIBUBSAN_LIBS):
	Define.
	* flag-types.h (enum sanitize_code): Add SANITIZE_LEAK.  Renumber
	SANITIZE_SHIFT, SANITIZE_DIVIDE, SANITIZE_UNREACHABLE, SANITIZE_VLA,
	SANITIZE_RETURN.
	* opts.c (common_handle_option): Handle -fsanitize=leak.
	* gcc.c (ADD_STATIC_LIBLSAN_LIBS, LIBLSAN_SPEC): Define.
	(LIBUBSAN_SPEC): Don't test LIBUBSAN_EARLY_SPEC.
	(LIBUBSAN_EARLY_SPEC): Remove.
	(SANITIZER_EARLY_SPEC): Don't do anything for libubsan.
	(SANITIZER_SPEC): Add -fsanitize=leak handling.
	(sanitize_spec_function): Handle %sanitize(leak).
	* doc/invoke.texi (-static-liblsan, -fsanitize=leak): Document.

	* c-c++-common/asan/no-redundant-instrumentation-7.c: Fix
	cleanup-tree-dump directive.

	* configure.tgt: Set LSAN_SUPPORTED=yes for x86_64-linux.
	* configure.ac (LSAN_SUPPORTED): New AM_CONDITIONAL.
	* configure: Regenerated.
	* lsan/Makefile.am (toolexeclib_LTLIBRARIES, lsan_files,
	liblsan_la_SOURCES, liblsan_la_LIBADD, liblsan_la_LDFLAGS): Add.
	* lsan/Makefile.in: Regenerated.

From-SVN: r205290
2013-11-22 22:13:08 +01:00
Thomas Schwinge de14871c88 Generally link to libgomp for -ftree-parallelize-loops=*.
gcc/
	* config/arc/arc.h (LINK_COMMAND_SPEC): For
	-ftree-parallelize-loops=*, link to libgomp and its dependencies.
	* config/ia64/hpux.h (LIB_SPEC): Likewise.
	* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
	* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
	* gcc.c (GOMP_SELF_SPECS): Update comment about libgomp's
	dependencies.
	libgomp/
	* libgomp.spec.in: Update comment about libgomp's dependencies.
	* configure.ac: Likewise.
	* configure: Regenerate.

From-SVN: r204517
2013-11-07 16:07:34 +01:00
Nick Clifton 2599016338 gcc.c (do_spec_1): Do not insert a space after a %* substitution unless...
* gcc.c (do_spec_1): Do not insert a space after a %* substitution
	unless it is the last part of a spec substring.
	* doc/invoke.texi (Spec Files): Document space insertion
	behaviour of %*.

From-SVN: r204446
2013-11-06 08:52:57 +00:00
Jeff Law 98906124e3 Makefile.def (target_modules): Remove libmudflap
* Makefile.def (target_modules): Remove libmudflap
	(languages): Remove check-target-libmudflap).
	* Makefile.in: Rebuilt.
	* Makefile.tpl (check-target-libmudflap-c++): Remove.
	* configure.ac (target_libraries): Remove target-libmudflap.
	Remove checks which disabled libmudflap on some systems.
	* configure: Rebuilt.
	* libmudflap: Directory removed.

	* Makefile.in (C_COMMON_OBJS): Remove tree-mudflap.
	(OBJS): Remove tree-nomudflap.o
	(GTFILES): Remove tree-mudflap.c
	* builtins.c (expand_builtin_alloc): Remove mudflap support.
	* gcc.c (MFWRAP_SPEC, MFLIB_SPEC): Likewise.
	(mfwrap_spec, mflib_spec): Likewise.
	(cpp_unique_options, cc1_options, static_specs): Likewise.
	* gimplify (gimplify_vla_decl, build_va_arg_indirect_ref): Likewise.
	* passes.def: Likewise.
	* toplev.c (compile_file, process_options): Likewise.
	* tree-inline.c (copy_tree_r): Likewise.
	* tree-pass.,h (make_pass_mudflap_1, make_pass_mudflap_2): Likewise.
	* varasm.c (make_decl_rtl, make_decl_rtl_for_debug): Likewise.
	(build_constant_desc, output_constant_def_contents): Likewise.
	(categorize_decl_for_section): Likewise.
	* tree-mudflap.c: Removed.
	* tree-mudflap.h: Removed.
	* tree-nomudflap.c: Removed.
	* bfin/uclinux.h (MFWRAP_SPEC): Remove.
	* moxie/uclinux.h (MFWRAP_SPEC): Likewise.
	* rs6000/aix.h (MFWRAP_SPEC, MFLIB_SPEC): Likewise.
	* config/sol2.h (MFLIB_SPEC): Likewise.
	* doc/install.texi: Remove mudflap references.
	* doc/passes.texi: Similarly.
	* doc/sourcebuild.texi: Similarly.
	* doc/invoke.texi: Remove mudlfap related options.

	* c-family/c-common.c (c_define_builtins): Remove mudflap support.
	* c-family/c.opt: Ignore and warn for mudflap options.

	* g++.dg/torture/pr49309.C: Removed.
	* gcc.dg/dfp/pr35739.c: Removed.

From-SVN: r204090
2013-10-26 04:14:34 -06:00
Richard Sandiford c328471880 alloc-pool.c, [...]: Add missing whitespace before "(".
gcc/
	* alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
	bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
	cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
	cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
	combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
	cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
	df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
	dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
	errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
	fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
	gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
	genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
	genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
	genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
	gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
	gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
	gimple.h, godump.c, graphite-clast-to-gimple.c,
	graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
	graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
	hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
	ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
	ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
	ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
	loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
	lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
	mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
	pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
	predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
	profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
	regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
	reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
	sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
	statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
	system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
	tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
	tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
	tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
	tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
	tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
	tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
	tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
	tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
	tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
	tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
	tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
	tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
	tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
	tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
	tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
	tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
	tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
	tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
	tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
	tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
	varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
	whitespace before "(".

From-SVN: r203004
2013-09-28 08:42:34 +00:00
Marek Polacek de5a5fa139 Merge ubsan into trunk.
From-SVN: r202113
2013-08-30 16:12:58 +00:00
Caroline Tice 2077db1be5 Commit the vtable verification feature.
Commit the vtable verification feature.  This feature is designed to
detect, at run time, if/when the vtable pointer in a C++ object has
been corrupted, before allowing virtual calls through that pointer. 
If pointer corruption is detected, execution of the program is halted.

libstdc++-v3 ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * fragment.am: Add XTEMPLATE_FLAGS.
        * configure.ac: Add definitions for --enable-vtable-verify.
        * acinclude.m4:  Add --enable-vtable-verify and
        --disable-vtable-verify; define --enable-vtable-verify; define
        VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS.
        * config/abi/pre/gnu.ver: Export symbols for vtable verification.
        * libsupc++/Makefile.am: Define vtv_sources and add it to
        libsupc___la_SOURCES and libsupc__convenience_la_SOURCES.
        * libsupc++/vtv_stubs.cc: New file.
        * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS.
        * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add
        VTV_CXXLINKFLAGS to CXXLINK.
        * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS
        to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK.
        * src/C++11/Makefile.am: Ditto.
        * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify.
        * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause
        cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS.
        * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate
        libvtv if --enable-vtable-verify was used; set cxxvtvflags; add
        cxxvtvflags to cxx_final.
        * testsuite/18_support/bad_exception/23591_thread-1.c: Add
        -fvtable-verify=none to compiler flags.
        * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none
        to compiler flags.
        * configure: Regenerated.
        * Makefile.in: Regenerated.
        * python/Makefile.in: Regenerated.
        * include/Makefile.in: Regenerated.
        * libsupc++/Makefile.in: Regenerated.
        * config.h.in: Regenerated.
        * po/Makefile.in: Regenerated.
        * src/Makefile.in: Regenerated.
        * src/c++98/Makefile.in: Regenerated.
        * src/c++11/Makefile.in: Regenerated.
        * doc/Makefile.in: Regenerated.
        * testsuite/Makefile.in: Regenerated.

top level ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * configure.ac: Add target-libvtv to target_libraries; disable libvtv
        on non-linux systems; add target-libvtv to noconfigdirs; add
        libsupc++/.libs to C++ library search paths.
        * configure: Regenerated.
        * Makefile.def: Add libvtv to target_modules; make libvtv depend on
        libstdc++ and libgcc.
        * Makefile.in: Regenerated.

include/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * vtv-change-permission.h: New file.

contrib/ChangeLog:
2013-08-06  Caroline Tice4  <cmtice@google.com>

        * gcc_update: Add libvtv files.

libgcc/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        config.host (extra_parts): Add vtv_start.o, vtv_end.o
        vtv_start_preinit.o and vtv_end_preinit.o.
        configure.ac: Add code to check/set enable_vtable_verify.
        Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is
        true.
        vtv_start_preinit.c: New file.
        vtv_end_preinit.c: New file.
        vtv_start.c: New file.
        vtv_end.c: New file.
        configure: Regenerated.

gcc/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * gcc.c (VTABLE_VERIFICATION_SPEC): New definition.
        (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC.
        * tree-pass.h: Add pass_vtable_verify.
        * varasm.c (assemble_variable): Add code to properly set the comdat
        section and name for the .vtable_map_vars section.
        (assemble_vtyv_preinit_initializer): New function.
        (default_sectin_type_flags):  Make sure .vtable_map_vars section has
        LINK_ONCE flag.
        * output.h: Add function decl for assemble_vtv_preinit_initializer.
        * vtable-verify.c: New file.
        * vtable-verify.h: New file.
        * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify
        initialiation levels.
        * timevar.def (TV_VTABLE_VERIFICATION): New definition.
        * passes.def: Insert pass_vtable_verify.
        * aclocal.m4: Reorder includes.
        * doc/invoke.texi: Add documentation for the flags -fvtable-verify=,
	-fvtv-debug and -fvtv-counts.
        * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o,
as appropriate, if -fvtable-verify=... is used.
        (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if
        -fvtable-verify=... is used.
        * Makefile.in (OBJS):  Add vtable-verify.o to list.
        (vtable-verify.o): Add new build rule.
        (GTFILES): Add vtable-verify.c to list.
        * common.opt (fvtable-verify=): New flag.
        (vtv_priority): Values for fvtable-verify= flag.
        (fvtv-counts): New flag.
(fvtv-debug): New flag.
        * tree.h (save_vtable_map_decl): New extern function decl.


gcc/cp/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * Make-lang.in (*CXX_AND_OBJCXX_OBJS):  Add vtable-class-hierarchy.o to
        list.
        (vtable-class-hierarchy.o): Add build rule.
        * cp-tree.h (vtv_start_verification_constructor_init_function): New
        extern function decl.
        (vtv_finish_verification_constructor_init_function): New extern
        function decl.
        (build_vtbl_address): New extern function decl.
        (get_mangled_vtable_map_var_name): New extern function decl.
        (vtv_compute_class_hierarchy_transitive_closure): New extern function
        decl.
        (vtv_generate_init_routine): New extern function decl.
        (vtv_save_class_info): New extern function decl.
        (vtv_recover_class_info): New extern function decl.
        (vtv_build_vtable_verify_fndecl): New extern function decl.
        * class.c (finish_struct_1): Add call to vtv_save_class_info if
        flag_vtable_verify is true.
        * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list.
        * vtable-class-hierarchy.c: New file.
        * mangle.c (get_mangled_vtable_map_var_name):  New function.
        * decl2.c (start_objects): Update function comment.
        (cp_write_global_declarations): Call vtv_recover_class_info,
        vtv_compute_class_hierarchy_transitive_closure and
        vtv_build_vtable_verify_fndecl, before calling
        finalize_compilation_unit, and call vtv_generate_init_rount after, IFF
        flag_vtable_verify is true.
        (vtv_start_verification_constructor_init_function): New function.
        (vtv_finish_verification_constructor_init_function): New function.
        * init.c (build_vtbl_address): Remove static qualifier from function.

libvtv/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        Initial check-in of new vtable verification feature.
        * configure.ac : New file.
        * acinclude.m4 : New file.
        * Makefile.am : New file.
        * aclocal.m4 : New file.
        * configure.tgt : New file.
        * configure: New file (generated).
        * Makefile.in: New file (generated).
        * vtv_set.h : New file.
        * vtv_utils.cc : New file.
        * vtv_utils.h : New file.
        * vtv_malloc.cc : New file.
        * vtv_rts.cc : New file.
        * vtv_malloc.h : New file.
        * vtv_rts.h : New file.
        * vtv_fail.cc : New file.
        * vtv_fail.h : New file.
        * vtv_map.h : New file.
        * scripts/run-testsuite.sh : New file.
        * scripts/sum-vtv-counts.c : New file.
        * testsuite/parts-test-main.h : New file.
        * testusite/dataentry.cc : New file.
        * testsuite/temp_deriv.cc : New file.
        * testsuite/register_pair.cc : New file.
        * testsuite/virtual_inheritance.cc : New file.
        * testsuite/field-test.cc : New file.
        * testsuite/nested_vcall_test.cc : New file.
        * testsuite/template-list-iostream.cc : New file.
        * testsuite/register_pair_inserts.cc : New file.
        * testsuite/register_pair_inserts_mt.cc : New file.
        * testsuite/event.list : New file.
        * testsuite/parts-test-extra-parts-views.cc : New file.
        * testsuite/parts-test-extra-parts-views.h : New file.
        * testsuite/environment-fail-32.s : New file.
        * testsuite/parts-test-extra-parts.h : New file.
        * testsuite/temp_deriv2.cc : New file.
        * testsuite/dlopen_mt.cc : New file.
        * testsuite/event.h : New file.
        * testsuite/template-list.cc : New file.
        * testsuite/replace-fail.cc : New file.
        * testsuite/Makefile.am : New file.
        * testsuite/Makefile.in: New file (generated).
        * testsuite/mempool_negative.c : New file.
        * testsuite/parts-test-main.cc : New file.
        * testsuite/event-private.cc : New file.
        * testsuite/thunk.cc : New file.
        * testsuite/event-defintiions.cc : New file.
        * testsuite/event-private.h : New file.
        * testsuite/parts-test.list : New file.
        * testusite/register_pair_mt.cc : New file.
        * testsuite/povray-derived.cc : New file.
        * testsuite/event-main.cc : New file.
        * testsuite/environment.cc : New file.
        * testsuite/template-list2.cc : New file.
        * testsuite/thunk_vtable_map_attack.cc : New file.
        * testsuite/parts-test-extra-parts.cc : New file.
        * testsuite/environment-fail-64.s : New file.
        * testsuite/dlopen.cc : New file.
        * testsuite/so.cc : New file.
        * testsuite/temp_deriv3.cc : New file.
        * testsuite/const_vtable.cc : New file.
        * testsuite/mempool_positive.c : New file.
        * testsuite/dup_name.cc : New file.

From-SVN: r201555
2013-08-06 20:38:59 -07:00
Jakub Jelinek 17042d2b38 gcc.c (SANITIZER_SPEC): Reject -fsanitize=address -fsanitize=thread linking.
* gcc.c (SANITIZER_SPEC): Reject -fsanitize=address -fsanitize=thread
	linking.

From-SVN: r199009
2013-05-17 14:17:14 +02:00
Han Shen f6bc1c4a12 cfgexpand.c (record_or_union_type_has_array_p): New function.
2013-05-07  Han Shen  <shenhan@google.com>

    gcc/
    * cfgexpand.c (record_or_union_type_has_array_p): New function.
    (expand_used_vars): Add logic handling '-fstack-protector-strong'.
    * common.opt (fstack-protector-strong): New option.
    * doc/cpp.texi (__SSP_STRONG__): New builtin "__SSP_STRONG__".
    * doc/invoke.texi (Optimization Options): Document
    "-fstack-protector-strong".
    * gcc.c (LINK_SSP_SPEC): Add 'fstack-protector-strong'.

    gcc/testsuite/
    * gcc.dg/fstack-protector-strong.c: New.
    * g++.dg/fstack-protector-strong.C: New.

    gcc/c-family/
    * c-cppbuiltin.c (c_cpp_builtins): Added "__SSP_STRONG__=3".

From-SVN: r198699
2013-05-07 21:33:01 +00:00
Rainer Orth e927b6ad35 Use -z ignore instead of --as-needed on Solaris
* configure.ac (gcc_cv_ld_as_needed): Set
	gcc_cv_ld_as_needed_option, gcc_cv_no_as_needed_option.
	Use -z ignore, -z record on *-*-solaris2*.
	(HAVE_LD_AS_NEEDED): Update comment.
	(LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION): Define.
	* configure: Regenerate.
	* config.in: Regenerate.
	* gcc.c (init_gcc_specs) [USE_LD_AS_NEEDED]: Use
	LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION.
	* config/sol2.h [HAVE_LD_AS_NEEDED] (USE_LD_AS_NEEDED): Define.
	* doc/tm.texi.in (USE_LD_AS_NEEDED): Allow for --as-needed
	equivalents.  Fix markup.
	* doc/tm.texi: Regenerate.

From-SVN: r197964
2013-04-15 10:31:57 +00:00
Senthil Kumar Selvaraj 6782438df7 common.opt: Add -gdwarf.
* common.opt: Add -gdwarf.
	* opts.c (common_handle_option): Handle it.
	* gcc.c (ASM_DEBUG_SPEC): Don't expect "-2" for DWARF.

Co-Authored-By: Jason Merrill <jason@redhat.com>

From-SVN: r197675
2013-04-10 10:47:55 -04:00
Joey Ye 3c27ce4cd4 re PR lto/50293 (-flto fails if GCC is installed in directory with space in path name)
2013-03-06  Joey Ye  <joey.ye@arm.com>

    PR lto/50293
    * gcc.c (convert_white_space): New function.
    (main): Handles white space in function name.

From-SVN: r196485
2013-03-06 06:32:03 +00:00
Jakub Jelinek a74db9bd86 re PR sanitizer/55374 ([asan] -static-libasan -static-libstdc++ doesn't work)
PR sanitizer/55374
	* config/gnu-user.h (LIBTSAN_EARLY_SPEC): Define.
	(STATIC_LIBTSAN_LIBS): Likewise.
	* gcc.c (ADD_STATIC_LIBTSAN_LIBS, LIBTSAN_EARLY_SPEC): Define.
	(LIBTSAN_SPEC): Add ADD_STATIC_LIBTSAN_LIBS, if LIBTSAN_EARLY_SPEC
	is defined, don't add anything else beyond that.
	(SANITIZER_EARLY_SPEC, SANITIZER_SPEC): Define.
	(LINK_COMMAND_SPEC): Use them.

From-SVN: r195761
2013-02-05 16:55:31 +01:00
Jakub Jelinek e60e09a0e0 re PR sanitizer/55374 ([asan] -static-libasan -static-libstdc++ doesn't work)
PR sanitizer/55374
	* gcc.c (LIBASAN_SPEC): Define just to ADD_STATIC_LIBASAN_LIBS if
	LIBASAN_EARLY_SPEC is defined.
	(LIBASAN_EARLY_SPEC): Define to empty string if not already defined.
	(LINK_COMMAND_SPEC): Add LIBASAN_EARLY_SPEC for -fsanitize=address,
	before %o.
	* config/gnu-user.h (LIBASAN_EARLY_SPEC): Define.

	* g++.dg/asan/large-func-test-1.C: Allow both _Zna[jm] in addition
	to _Znw[jm] in the backtrace.  Allow _Zna[jm] to be the first frame
	printed in backtrace.
	* g++.dg/asan/deep-stack-uaf-1.C: Use malloc instead of operator new
	to avoid errors about mismatched allocation vs. deallocation.

From-SVN: r195585
2013-01-30 19:05:53 +01:00
Terry Guo e7f49d92ca Makefile.in (s-mlib): New argument MULTILIB_REUSE.
2013-01-13  Terry Guo  <terry.guo@arm.com>

        * gcc/Makefile.in (s-mlib): New argument MULTILIB_REUSE.
        * gcc/doc/fragments.texi: Document MULTILIB_REUSE.
        * gcc/gcc.c (multilib_reuse): New internal spec.
        (set_multilib_dir): Also search multilib from multilib_reuse.
        * gcc/genmultilib (tmpmultilib3): Refactor code.
        (tmpmultilib4): Ditto.
        (multilib_reuse): New multilib argument.

From-SVN: r195134
2013-01-13 10:12:07 +00:00
Richard Sandiford d1e082c2c2 Update copyright years in gcc/
From-SVN: r195098
2013-01-10 20:38:27 +00:00
Nick Clifton b352afbab2 Support -fuse-ld=bfd and -fuse-ld=gold
PR driver/55470
	* collect2.c (main): Support -fuse-ld=bfd and -fuse-ld=gold.

	* common.opt: Add fuse-ld=bfd and fuse-ld=gold.

	* gcc.c (LINK_COMMAND_SPEC): Pass -fuse-ld=* to collect2.

	* opts.c (comman_handle_option): Ignore -fuse-ld=bfd and
	-fuse-ld=gold.

	* doc/invoke.texi: Document -fuse-ld=bfd and -fuse-ld=gold.

Co-Authored-By: Doug Kwan <dougkwan@google.com>
Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
Co-Authored-By: Matthias Klose <doko@debian.org>

From-SVN: r194983
2013-01-07 08:54:33 -08:00