This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Nov 2013 14:02:43 +0100
- Subject: Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Authentication-results: sourceware.org; auth=none
- References: <20131031091116 dot GD54327 at msticlxl57 dot ims dot intel dot com> <Pine dot LNX dot 4 dot 64 dot 1311012204040 dot 31271 at digraph dot polyomino dot org dot uk> <CAMbmDYaVb9Cx_WoVmb78S3Y2hAiX7paC+cp1EQAYz2vnAUj=jQ at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Nov 05, 2013 at 04:54:38PM +0400, Ilya Enkovich wrote:
> 2013/11/2 Joseph S. Myers <firstname.lastname@example.org>:
> > 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,
> 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.