On Tue, 17 Jan 2012, Aldy Hernandez wrote: > > > > What I have in mind is to abstract out the initialization of TM builtins > > > from > > > gtm-builtins.def (through its inclusion in builtins.def) into a separate > > > function that we can call either in c_define_builtins() from the C-ish > > > front-ends, or from lto_define_builtins (once we encounter a TM builtin > > > and > > > enable flag_tm appropriately). > > > > Hm? They are included in builtins.def, that looks appropriate for > > middle-end builtins. Thus they should be initialized by lto1, too. > > Are they not? > > Since flag_tm is NULL, when lto_define_builtins runs, the TM builtins do not > get initialized. This is because DEF_TM_BUILTIN is predicated on flag_tm.
Ok, so arrange that -fgnu-tm is enabled at link-time as soon as it was enabled in one TU. You can do that alongside handling of OPT_fPIC, etc. in lto-wrapper.c:merge_and_complain. > It isn't until streamer_get_builtin_tree() that we realize the object file has > a TM builtin. I see. Probably similar issues exist with -fopenmp and the GOMP builtins. Richard.