This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR lto/61048 Define missed builtins on demand


On 15.10.2014 12:09, Richard Biener wrote:
On Wed, Oct 15, 2014 at 8:59 AM, Jakub Jelinek <jakub@redhat.com> wrote:
On Tue, Oct 14, 2014 at 08:39:40PM +0400, Ilya Palachev wrote:
Attached patch fixes PR lto/61048 -
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61048

Given that the patch just replaces an ICE with a necessary link failure, I'd say
it is done at the wrong place, instead during the LTO option handling you
should error out if there are incompatibilities in -fsanitize options
(any object compiled with flag_sanitize & SANITIZE_USER_ADDRESS, but
link done without that, ditto for SANITIZE_KERNEL_ADDRESS, SANITIZE_THREAD.
And finally if flag_sanitize & (SANITIZE_UNDEFINED | SANITIZE_NONDEFALT)
is non-zero but during linking it is zero (it doesn't really matter which
exact undefined sanitization options are used at what time).

Yep.  As with other options this looks like it needs "conservative"
merging.  Which might be more involved than for other cases - but well...

Look at existing examples in gcc/lto-opts.c and gcc/lto-wrapper.c.

I have seen that in r180827 you have removed functions lto_read_file_options from gcc/lto-streamer.h and lto_read_all_file_options from gcc/lto/lto.c. Do you mean that something like these functions should be added again?

Maybe it will be worthwhile to report the user what options he forget to add to the linkning command?

For example, without -flto option the following error is reported:

$ g++ -c test.cpp -fsanitize=address -o test_nolto.o
$ g++ test_nolto.o -o test_nolto
test_nolto.o:test.cpp:function main: error: undefined reference to '__asan_report_load4' test_nolto.o:test.cpp:function __static_initialization_and_destruction_0(int, int): error: undefined reference to '__asan_before_dynamic_init' test_nolto.o:test.cpp:function __static_initialization_and_destruction_0(int, int): error: undefined reference to '__asan_after_dynamic_init' test_nolto.o:test.cpp:function _GLOBAL__sub_D_00099_0_main: error: undefined reference to '__asan_unregister_globals' test_nolto.o:test.cpp:function _GLOBAL__sub_I_00099_1_main: error: undefined reference to '__asan_init_v4' test_nolto.o:test.cpp:function _GLOBAL__sub_I_00099_1_main: error: undefined reference to '__asan_register_globals'
collect2: error: ld returned 1 exit status

Maybe it will be better to print something like:

test_nolto.o:test.cpp: error: compiled with -fsanitize=address, but this option is not specified in linking command.

?

Thanks,
Ilya


Richard.

BTW, in your patches please watch formatting, you didn't use space before (.

         Jakub



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]