[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-11 Thread mrs at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #54 from mrs at gcc dot gnu.org mrs at gcc dot gnu.org 2013-02-11 22:36:28 UTC --- Author: mrs Date: Mon Feb 11 22:36:23 2013 New Revision: 195956 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195956 Log: 2013-02-11

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-04 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #48 from Alexander Potapenko glider at google dot com 2013-02-04 10:11:32 UTC --- (In reply to comment #40) if (ctor_recA-position ctor_recB-position) return -1; if (ctor_recA-position ctor_recB-position)

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-04 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #49 from Alexander Potapenko glider at google dot com 2013-02-04 10:13:49 UTC --- I agree with Jakub: it's better to return back to the qsort version of the patch, since it fixes ASan as well, but also provides better support

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-04 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #50 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-04 17:24:40 UTC --- (In reply to comment #49) I agree with Jakub: it's better to return back to the qsort version of the patch, since it fixes ASan as well, but

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-04 Thread mrs at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #51 from mrs at gcc dot gnu.org mrs at gcc dot gnu.org 2013-02-04 20:08:34 UTC --- Author: mrs Date: Mon Feb 4 20:08:29 2013 New Revision: 195735 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195735 Log: 2013-02-04

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-04 Thread mrs at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #52 from mrs at gcc dot gnu.org mrs at gcc dot gnu.org 2013-02-04 21:07:42 UTC --- Author: mrs Date: Mon Feb 4 21:07:35 2013 New Revision: 195737 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=195737 Log: 2013-02-04

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-04 Thread mrs at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 m...@gcc.gnu.org mrs at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-03 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #47 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-03 15:16:50 UTC --- posted proposed patch and regression testresults at... http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00055.html

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #36 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-02 08:46:55 UTC --- } ctor_record; Why? }; should be enough IMHO in C++. Or does GTY still require it? int ctor_index = -1; ... ctor_index++ What is this for?

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #37 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 15:31:37 UTC --- typedef struct GTY(()) ctor_record { rtx symbol; int priority; /* constructor priority */ int position; /* original

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #38 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-02 15:38:31 UTC --- Obviously it shouldn't be typedef in that case. Anyway, this part is not a big deal, just a nit.

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #39 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 18:16:39 UTC --- While testing whether the single qsort was sufficient, the origin of the problem on darwin was clarified. In machopic_asm_out_constructor, after

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread mrs at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 m...@gcc.gnu.org mrs at gcc dot gnu.org changed: What|Removed |Added CC||mrs at

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #41 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 20:11:07 UTC --- Created attachment 29338 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29338 alternative approach of only inserting asan static constructor

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 Jack Howarth howarth at nitro dot med.uc.edu changed: What|Removed |Added Attachment #29338|0 |1

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #43 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 20:19:40 UTC --- (In reply to comment #40) Actually I think we should junk sorting entirely and use the alternative approach of the patch in Comment 42. That

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #44 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 20:41:15 UTC --- (In reply to comment #40) Doesn't the test case I showed in Comment 28 qualify as working across translaional units? That test case still

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #45 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 22:53:59 UTC --- (In reply to comment #40) Also the impact of the proposed patch in Comment 42 could be limited even further by using... if (flag_asan

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-02 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #46 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-03 00:10:02 UTC --- (In reply to comment #40) Also with the patch in Comment 42, the failing test case converted into a shared library loaded via dlopen works

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-01 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #31 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-01 16:46:35 UTC --- FYI, the proof of concept patch from Comment 27 produces no regressions in the testsuite on x86_64-apple-darwin12...

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-01 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #32 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-01 21:22:06 UTC --- Created attachment 29332 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29332 first attempt at va_gc implementation The attached patch is

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-01 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #33 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-01 21:45:42 UTC --- Replacing the... ctors-qsort (sort_by_ctor_priority); with... qsort(ctors, ctor_index+1, sizeof(ctor_record), sort_by_ctor_priority);

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-01 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #34 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-01 22:19:45 UTC --- Can you explain why normal qsort wouldn't do the sort in one pass? You just do if (ctor_recordA-priority ctor_recordB-priority) return -1;

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-02-01 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #35 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-02 05:51:31 UTC --- Created attachment 29334 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29334 working va_gc implementation

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #23 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-31 22:01:39 UTC --- Created attachment 29323 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29323 proposed patch for dynamic allocation Proposed patch for

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #24 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-31 22:22:50 UTC --- Suspect we need to use... ctors[ctor_index].symbol = copy_rtx(symbol); in machopic_asm_out_constructor although I am unclear on what need

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #25 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-31 22:25:45 UTC --- (In reply to comment #24) Suspect we need to use... ctors[ctor_index].symbol = copy_rtx(symbol); in machopic_asm_out_constructor

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #26 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-01 02:30:10 UTC --- Created attachment 29324 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29324 proposed patch for dynamic allocation and qsort of ctor records

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 Jack Howarth howarth at nitro dot med.uc.edu changed: What|Removed |Added Attachment #29324|0 |1

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #28 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-01 03:00:37 UTC --- qsort version of patch works with trivial shared lib test code of... % cat libcov.C struct c18 { virtual void bar() { } }; c18 ret; %

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #29 from Jack Howarth howarth at nitro dot med.uc.edu 2013-02-01 05:52:13 UTC --- The proposed patch with dynamic allocation and qsort of the ctor records by priority field reduces the number of unexpected failures for...

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-31 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #30 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-01 07:31:24 UTC --- Don't want to spend too much time on this, so just a few hints: 1) you want to store this in a vector (see vec.h) 2) rtxs are GC allocated, you don't

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #10 from Alexander Potapenko glider at google dot com 2013-01-30 12:29:00 UTC --- I suppose this isn't important. __mod_term_func are destructors, and they even aren't called in the crashing program.

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #11 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-30 14:23:51 UTC --- (In reply to comment #10) I suppose this isn't important. __mod_term_func are destructors, and they even aren't called in the crashing program.

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #12 from Alexander Potapenko glider at google dot com 2013-01-30 14:32:54 UTC --- The question is why does... if (builtin_decl_implicit_p (BUILT_IN_ASAN_INIT)) return; in initialize_sanitizer_builtins() not

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #13 from Jakub Jelinek jakub at gcc dot gnu.org 2013-01-30 14:41:14 UTC --- (In reply to comment #12) This one is a necessary one. asan_finish_file inserts __asan_init into the array of constructors (aka __mod_init_func

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #14 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-30 15:57:11 UTC --- (In reply to comment #13) See in gcc/config/darwin.h... /* The Apple assembler and linker do not support constructor priorities. */ #undef

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #15 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-30 16:28:17 UTC --- It also seems that Solaris 2 will suffer from this issue when not using Gold... #ifndef USE_GLD /* The Solaris linker doesn't understand

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #16 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-30 16:31:14 UTC --- This limitation all exists for clang on darwin... http://llvm.org/bugs/show_bug.cgi?id=12556

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #17 from Jakub Jelinek jakub at gcc dot gnu.org 2013-01-30 16:32:11 UTC --- Solaris doesn't support Asan in gcc, and perhaps it is time to admit that Darwin doesn't either.

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread kcc at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #18 from Kostya Serebryany kcc at gcc dot gnu.org 2013-01-30 16:36:01 UTC --- Yea... We don't have interest in supporting gcc-asan-darwin, sorry.

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #19 from Jakub Jelinek jakub at gcc dot gnu.org 2013-01-30 16:43:03 UTC --- Well, if somebody does the work and in a clean way that won't penalize targets with sane linkers and object formats, I'm not objecting, I just am not

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #20 from Alexander Potapenko glider at google dot com 2013-01-30 17:07:25 UTC --- (In reply to comment #19) Well, if somebody does the work and in a clean way that won't penalize targets with sane linkers and object formats,

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #21 from Alexander Potapenko glider at google dot com 2013-01-30 17:30:18 UTC --- Created attachment 29309 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29309 Dummy patch that reverses the order of the constructors

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-30 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #22 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-30 23:40:56 UTC --- (In reply to comment #21) The proposed patch reduces the number of unexpected failures in the g++ testsuite when using... make -k check-g++

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-29 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 Alexander Potapenko glider at google dot com changed: What|Removed |Added CC|

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-29 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #6 from Alexander Potapenko glider at google dot com 2013-01-29 09:59:09 UTC --- Looking at the disassembly I see that __asan_init is placed into some __GLOBAL__sub_I_00099_1_cov.cc function, which isn't being called at runtime

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-29 Thread glider at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #7 from Alexander Potapenko glider at google dot com 2013-01-29 11:56:02 UTC --- Here's the dump of __mod_init_func (the static ctors array): === Disassembly of section

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-29 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #8 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-29 22:04:28 UTC --- Created attachment 29302 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29302 assembly file for reduced testcase from comment 5 generated

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2013-01-29 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #9 from Jack Howarth howarth at nitro dot med.uc.edu 2013-01-29 22:15:29 UTC --- Is it significant that in the assembly, the .mod_term_func section section (which captures the call to __asan_init) is emitted before the

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2012-12-07 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #1 from Jack Howarth howarth at nitro dot med.uc.edu 2012-12-07 14:48:57 UTC --- Created attachment 28894 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28894 assembly file for covariant3.C compiled with -fsanitize=address

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2012-12-07 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #2 from Jack Howarth howarth at nitro dot med.uc.edu 2012-12-07 14:50:34 UTC --- Created attachment 28895 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28895 gdb log of stepi walk from 38th breakpoint of

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2012-12-07 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #3 from Jack Howarth howarth at nitro dot med.uc.edu 2012-12-07 15:44:16 UTC --- This might be due to the code... /* Startup code should go to startup subsection unless it is unlikely executed (this happens especially

[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

2012-12-07 Thread howarth at nitro dot med.uc.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617 --- Comment #4 from Jack Howarth howarth at nitro dot med.uc.edu 2012-12-08 03:14:29 UTC --- The failing testcase in gdb appears as... gdb ./covariant3.exe ... (gdb) br _GLOBAL__sub_I_covariant3.C Breakpoint 1 at 0x11ce2: file