Patchwork [testsuite] Run TLS torture tests with -fpic etc.

login
register
mail settings
Submitter Ramana Radhakrishnan
Date June 15, 2011, 4:06 p.m.
Message ID <BANLkTimSFTZYD7HzHmf2cWi-B0HpEKXmbg@mail.gmail.com>
Download mbox | patch
Permalink /patch/100549/
State New
Headers show

Comments

Ramana Radhakrishnan - June 15, 2011, 4:06 p.m.
>
> After it has been determined how to check for PIE support, I'm checking
> this in.


I haven't bisected it and not investigated failures in detail because
I'm about to walk out of the door. This patch might have broken
testing with arm-linux-gnueabi cross with defaults set to v7-a. (
configured with --with-arch=armv7-a --with-fpu=neon
--with-float=-softfp) . The GNU ARM linker doesn't allow PIE modules
where objects contain the MOVW_ABS_NC and MOVT_ABS relocations (which
are actually absolute relocations) and thus we should require -fPIC /
-fpic for these cases as well.

This *gross* hack below allows testing to proceed atleast for tls.exp
as far as arm-linux-gnueabi is concerned. What's the best way of
taking this forward ?

cheers
Ramana

2011-06-15  Ramana Radhakrishnan  <ramana.radhakrishnan@linaro.org>

	* lib/wrapper.exp (target-support.exp): Load it.
	(${tool}_maybe_build_wrapper): Add -fPIC to the options list for
	testglue.
Mike Stump - June 15, 2011, 5 p.m.
On Jun 15, 2011, at 9:06 AM, Ramana Radhakrishnan wrote:
>> After it has been determined how to check for PIE support, I'm checking
>> this in.
> 
> I haven't bisected it and not investigated failures in detail because
> I'm about to walk out of the door. This patch might have broken
> testing with arm-linux-gnueabi cross with defaults set to v7-a. (
> configured with --with-arch=armv7-a --with-fpu=neon
> --with-float=-softfp) . The GNU ARM linker doesn't allow PIE modules
> where objects contain the MOVW_ABS_NC and MOVT_ABS relocations (which
> are actually absolute relocations) and thus we should require -fPIC /
> -fpic for these cases as well.

The patch isn't suitable as is.  If -PIE requires -fPIC, then anything that adds it or tortures on it, should add both, or torture on both.
Ramana Radhakrishnan - June 15, 2011, 10:07 p.m.
> The patch isn't suitable as is.  If -PIE requires -fPIC, then anything that adds it or tortures on it, should add both, or torture on both.

The ABS relocs that I mentioned were from testglue.o which isn't built
PIE or PIC and that's the reason for the failures to show up. Maybe
the right solution is to rebuild <tool>*tg.o with anything that
tortures on PIE or PIC ?

Yes, I wasn't suggesting for a moment that this patch was suitable   -
I'm seeing a high number of failures in cross-testing . It was a big
hammer 20 minutes before I left work to separate test failures from
these and the other failures that I'm seeing.


cheers
Ramana

Patch

diff --git a/gcc/testsuite/lib/wrapper.exp b/gcc/testsuite/lib/wrapper.exp
index b7f7773..37c20f6 100644
--- a/gcc/testsuite/lib/wrapper.exp
+++ b/gcc/testsuite/lib/wrapper.exp
@@ -20,7 +20,7 @@ 
 # needs it.  FILENAME is the path to the wrapper file.  If there are
 # additional arguments, they are command-line options to provide to
 # the compiler when compiling FILENAME.
-
+load_lib target-supports.exp
 proc ${tool}_maybe_build_wrapper { filename args } {
     global gluefile wrap_flags

@@ -30,6 +30,9 @@  proc ${tool}_maybe_build_wrapper { filename args } {
        set_ld_library_path_env_vars
        set saved_wrap_compile_flags [target_info wrap_compile_flags]
        set flags [join $args " "]
+       if { [check_effective_target_fpic] } then {
+           lappend flags "-fPIC"
+       }
        # The wrapper code may contain code that gcc objects on.  This
        # became true for dejagnu-1.4.4.  The set of warnings and code
        # that gcc objects on may change, so just make sure -w is always