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, MPX, 2/X] Pointers Checker [8/25] Languages support


On Tue, Nov 05, 2013 at 04:54:38PM +0400, Ilya Enkovich wrote:
> 2013/11/2 Joseph S. Myers <joseph@codesourcery.com>:
> > On Thu, 31 Oct 2013, Ilya Enkovich wrote:
> >
> >> This patch adds support Pointer Bounds Checker into c-family and LTO
> >> front-ends.  The main purpose of changes in front-end is to register all
> >> statically initialized objects for checker.  We also need to register
> >> such objects created by compiler.
> >
> > What happens with statically initialized TLS objects?  It would seem that
> > you need something like how the C++ front end handles static constructors
> > for C++11 thread-local objects, but I don't see anything obvious for that
> > here.
> 
> This patch takes care of pointers initialized by linker.  TLS objects
> are dynamically allocated for each thread and should have some
> constructor to perform initialization.  And if there is such
> constructors then it should be instrumented by Pointer Bounds Checker.
>  Therefore it should not require additional changes in front-end,
> right?
> 
> The only problem I now see for TLS objects is that in my constructors
> initialize bounds for an actual TLS object, not for object in .tdata.
> How can I refer to .tdata objects in GIMPLE to get correct bounds
> initialization for .tdata section?

You can't.  .tdata section is only used as data to copy to the TLS objects
when they are initialized (libc copies the whole .tdata section to the right
spot in the TLS are of each thread, followed by clearing the area
corresponding to .tbss section's size).  TLS objects can have dynamic
constructors (fairly recent change), but they don't have to, if they don't,
they are just initialized by the memcpy from .tdata section.

	Jakub


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