The patch seems to work on a simple test. Let me digest it. I am trying to understand if there are problems with it other than the added complexity (which is what I don't like the most).
-Wl,-Ttext-segment=0x3600000000 does not work with binutils-gold. gold understands -Wl,-Ttext=0x3600000000, but bfd ld doesn't. Do you know any flag supported by both? --kcc On Thu, Feb 14, 2013 at 12:48 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Wed, Feb 13, 2013 at 04:19:14PM +0100, Jakub Jelinek wrote: >> Here is the patch, works just fine for me here during asan.exp testing. >> You can very easily either install and enable prelink on one of your >> x86_64-linux testing boxes, or just install it and add test that >> will say prelink -r 0x3600000000 some test shared library and then >> just use it in sanitized program (that will also verify that you can mmap >> libraries in that range), or even just write a test that will in a >> non-instrumented ctor with lower priority than asan's priority >> mmap a few pages at 0x3000000000 and close to 0x3fffff0000 >> and store some data into those buffers later on in sanitized code. > > I forgot you don't even need prelink -r 0x3600000000 for the testing, you > can just link it as > $(CXX) -shared -Wl,-Ttext-segment=0x3600000000 -fPIC -o testlib.so > -fsanitize=address testlib.C > So, put some asan tests into the executable, some tests into the shared > library and link the executable against the shared library placed in the > area where prelink allocates addresses to shared libraries. > Perhaps build 3 such libraries, one at 0x3000000000, one somewhere middle > of that range and one close to the end of the range. > > Jakub