This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ld/testsuite] Skip "Mixing PIC and non-PIC" testcase on ARM/AArch64 if when no -fpie or -fPIE
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jiong Wang <jiong dot wang at foss dot arm dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Wed, 2 Mar 2016 11:09:16 -0800
- Subject: Re: [ld/testsuite] Skip "Mixing PIC and non-PIC" testcase on ARM/AArch64 if when no -fpie or -fPIE
- Authentication-results: sourceware.org; auth=none
- References: <20160223175814 dot GA2858 at intel dot com> <alpine dot LSU dot 2 dot 20 dot 1602241843180 dot 20277 at wotan dot suse dot de> <CAJimCsG=1u_yM6SBFAxCxB4JvWtxO5fZ22+OmG6UC_RYON3DdA at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602251356320 dot 20277 at wotan dot suse dot de> <CAMe9rOpzw08UPTfjFEhixY=x4je--03ZdsXdrpdS-2sYSxDE3Q at mail dot gmail dot com> <56D5A0D9 dot 5070500 at foss dot arm dot com> <CAMe9rOq_sXd9qccTddvMB8sTBgOPWq0wgiqSQX4iSyUVys4n-Q at mail dot gmail dot com> <56D6D676 dot 5020202 at foss dot arm dot com> <CAMe9rOq__U54POpvUgKrYTinD1J0josM6MWph3d+zGmm=v3rgQ at mail dot gmail dot com> <CAMe9rOq_LZTeC+Zkd6L-o=8Sd=hbvmTDJ+LOCMXfqVAuyU+5CQ at mail dot gmail dot com> <56D6E982 dot 1090607 at foss dot arm dot com> <CAMe9rOptA2-Pc6m6mJzP8=p+kczDe180zLjWOymEicdOxEnP0Q at mail dot gmail dot com> <CAMe9rOo3AYCSfOMue=L_b0k9ORbMOY9ptPEJ4tsyvYdkD21o8Q at mail dot gmail dot com> <56D71011 dot 9040306 at foss dot arm dot com> <CAMe9rOrFr4uaVWpu4OWG_p62=NW4jVnR63qmrs3ho61WVLg2=w at mail dot gmail dot com> <56D72496 dot 4040008 at foss dot arm dot com> <CAMe9rOraeOZ5_jX0zZQVW0CJr=YNVp9aD==7pG3+74GhvQmtAw at mail dot gmail dot com> <56D72B14 dot 5060003 at foss dot arm dot com> <CAMe9rOpWN3oS+GujbBYsWEAFJy0r=E0Qy8yNcVuTYS-nv-L1nA at mail dot gmail dot com> <n99si08so1x dot fsf at foss dot arm dot com>
On Wed, Mar 2, 2016 at 10:51 AM, Jiong Wang <jiong.wang@foss.arm.com> wrote:
>
> H.J. Lu writes:
>
>> On Wed, Mar 2, 2016 at 10:04 AM, Jiong Wang <jiong.wang@foss.arm.com> wrote:
>>>
>>>
>>> On 02/03/16 17:40, H.J. Lu wrote:
>>>>
>>>> On Wed, Mar 2, 2016 at 9:36 AM, Jiong Wang <jiong.wang@foss.arm.com>
>>>> wrote:
>>>>>
>>>>>
>>>>> On 02/03/16 16:40, H.J. Lu wrote:
>>>>>>
>>>>>> On Wed, Mar 2, 2016 at 8:08 AM, Jiong Wang <jiong.wang@foss.arm.com>
>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Have you looked at the testcase I added? Are there anything
>>>>>>>>>> which are target specific?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I do have looked at the testcase, they do be purely C code.
>>>>>>>>>
>>>>>>>>> If the convention of generic is syntax generic instead of both syntax
>>>>>>>>> and
>>>>>>>>> sematics, I don't have further comment on this.
>>>>>>>>>
>>>>>>>>> Anyway, attached patch skips the non-pie version "Mixing PIC and
>>>>>>>>> non-PIC"
>>>>>>>>> testcase.
>>>>>>>>>
>>>>>>>>> Not sure if it's trivial enough to qualify obvious, so OK for master
>>>>>>>>> branch?
>>>>>>>>>
>>>>>>>>> 2016-03-02 Jiong Wang <jiong.wang@arm.com>
>>>>>>>>>
>>>>>>>>> ld/testsuite/
>>>>>>>>>
>>>>>>>>> * ld-elf/shared.exp (mix_pic_and_non_pic): Only run on ARM and
>>>>>>>>> AArch64
>>>>>>>>> when -fPIE or -fpie specified.
>>>>>>>>
>>>>>>>> That is wrong. If you don't want to see FAIL, you can skip the whole.
>>>>>>>> mix_pic_and_non_pic. Please don't modify mix_pic_and_non_pic.
>>>>>>>
>>>>>>>
>>>>>>> Then, how about the updated version?
>>>>>>>
>>>>>>> 2016-03-02 Jiong Wang <jiong.wang@arm.com>
>>>>>>>
>>>>>>> ld/testsuite/
>>>>>>>
>>>>>>> * ld-elf/shared.exp: Skip "Mixing PIC and non-PIC" on ARM and
>>>>>>> AArch64
>>>>>>> if -fpie or -fPIE not specified.
>>>>>>>
>>>>>> Please use setup_xfail instead of skipping.
>>>>>
>>>>>
>>>>> setup_xfail will actually update one global xfail related flag which
>>>>> affect
>>>>> the
>>>>> pass/fail after it. so you must put "setup_xfail" accurately before the
>>>>> fail
>>>>> you
>>>>> want to xfail or the pass you want to xpass.
>>>>
>>>> There is
>>>>
>>>> ld-elf/comm-data.exp:setup_xfail "arm*-*-*" "ld/13802"
>>>>
>>>> How does it work?
>>>
>>>
>>> I think that's because it's using run_ld_link_test, while your
>>> "mix_pic_and_non_pic"
>>> is using run_cc_link_test.
>>>
>>> From ld.log, those compile steps in run_cc_link_test is treated as a
>>> seperate tesing, thus
>>> an internal PASS is generated. So if you put setup_xfail outside
>>> mix_pic_and_non_pic, then
>>> the flag setup will be wrongly taken by the later PASS and turns it into
>>> XPASS.
>>
>> Have you tried? I tried:
>>
>>
>> diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
>> index 0624f0d..69b9e38 100644
>> --- a/ld/testsuite/ld-elf/shared.exp
>> +++ b/ld/testsuite/ld-elf/shared.exp
>> @@ -649,5 +649,6 @@ proc mix_pic_and_non_pic {cflags ldflags} {
>> }
>> }
>>
>> +setup_xfail "*-*-*"
>> mix_pic_and_non_pic "" ""
>> mix_pic_and_non_pic "-fPIE" "-pie"
>>
>> I only got
>>
>> XPASS: Build libpr19719a.so
>
> That's exactly the problem I said. The xfail flag has taken by the
> following check, no?
>
> With the use of "setup_xfail", what we are expecting is:
>
> PASS: Build libpr19719a.so
> XFAIL: Mixing PIC and non-PIC
>
> not:
>
> XPASS: Build libpr19719a.so
> FAIL: Mixing PIC and non-PIC
>
Try this.
--
H.J.
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 0624f0d..4d7f55b 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -592,7 +592,7 @@ if { [istarget *-*-linux*]
]
}
-proc mix_pic_and_non_pic {cflags ldflags} {
+proc mix_pic_and_non_pic {xfails cflags ldflags} {
set testname "Mixing PIC and non-PIC"
if { ![ string match "" $cflags$ldflags] } {
set testname "$testname ($cflags $ldflags)"
@@ -641,6 +641,10 @@ proc mix_pic_and_non_pic {cflags ldflags} {
exec cp tmpdir/libpr19719a.so tmpdir/libpr19719.so
+ foreach targ $xfails {
+ setup_xfail $targ
+ }
+
set exec_output [run_host_cmd tmpdir/pr19719 ""]
if {![string match "PASS" $exec_output]} {
fail $testname
@@ -649,5 +653,5 @@ proc mix_pic_and_non_pic {cflags ldflags} {
}
}
-mix_pic_and_non_pic "" ""
-mix_pic_and_non_pic "-fPIE" "-pie"
+mix_pic_and_non_pic [list "arm*-*-*" "aarch64*-*-*"] "" ""
+mix_pic_and_non_pic [] "-fPIE" "-pie"