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 07:44:20 -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> <CAMe9rOrSNYV_x-5aU7K+hXHNrinE9Co8y1F5VUkY+SoRQize=g at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241753490 dot 20277 at wotan dot suse dot de> <CAMe9rOpZNHtKRvx+5QurEOcVU96WEQuBRPJ6UorocjE-8Jd+vQ at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1602241808400 dot 20277 at wotan dot suse dot de> <CAMe9rOpAkC238Gvji0rf1_wBqEAZDDeTkhp_o-BirUrTa622aA at mail dot gmail 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> <56D708E2 dot 3050404 at foss dot arm dot com>
On Wed, Mar 2, 2016 at 7:38 AM, Jiong Wang <jiong.wang@foss.arm.com> wrote:
>
>>>>>>>>> I'm seeing:
>>>>>>>>>
>>>>>>>>> NA->FAIL: Mixing PIC and non-PIC
>>>>>>>>> on aarch64-none-linux-gnu.
>>>>>>>>
>>>>>>>> You can either fix aarch64 backend or skip the test for aarch64.
>>>>>>>
>>>>>>>
>>>>>>> H.J,
>>>>>>>
>>>>>>> For your testcase, AArch64 is not generating dynamic relocation
>>>>>>> for
>>>>>>> weak undefined symbol referenced from non-pic code when linking
>>>>>>> exectuable, instead, it's resolved to zero during static linking
>>>>>>> stage.
>>>>>>> As far as I know, this behavior is exactly what's described here
>>>>>>> at
>>>>>>>
>>>>>>> https://sourceware.org/ml/binutils/2008-04/msg00269.html
>>>>>>>
>>>>>>> And reading those historical discussions,
>>>>>>>
>>>>>>> https://sourceware.org/ml/binutils/2008-04/msg00032.html
>>>>>>> https://sourceware.org/ml/binutils/2008-02/msg00264.html
>>>>>>>
>>>>>>> Looks to me the ld behavior changes introduced by your patch is
>>>>>>> quite
>>>>>>> sensitive and there still be lack of consensus.
>>>>>>
>>>>>> What linker change were you referring to? I only added a testcase.
>>>>>
>>>>>
>>>>> I mean those linker changes added together with this testcase.
>>>>>
>>>>> commit aec6b87e0b66d707ead62ca40d220ee78b4cf5a5
>>>>> Author: H.J. Lu <hjl.tools@gmail.com>
>>>>> Date: Fri Feb 26 04:16:15 2016 -0800
>>>>>
>>>>> [x86] Resolve non-PIC undefweak symbols in executable
>>>>>
>>>> As far as aarch64 backend is concerned, I only added a testcase.
>>>
>>>
>>> Well, then why you put it under generic directory? and without
>>> restricting
>>> it
>>> on x86? this is implicitly affect all targets, and enforcing all targets
>>> to
>>> follow
>>> the changes on x86. I think similar changes should only be encouraged to
>>> other target
>>> if it's conventional rules, or it's clearly documented by generic or that
>>> target's ELF
>>> specification.
>>>
>>> While reading from
>>> http://www.skyfree.org/linux/references/ELF_Format.pdf,
>>>
>>> "The link editor does not extract archive members to resolve undefined
>>> weak symbols. Unresolved weak symbols have a zero value."
>>>
>>> Looks to me the spec is even more strict that weak symbol's life is
>>> defined
>>> to be ended
>>> after static linking stage. All unresolved weak symbols are assigned zero
>>> value.
>>>
>>> IMO, the support of weak symbol under various rare and complex scenarios
>>> are
>>> very
>>> target specific, thus I'd either move this testcase under x86 directory
>>> or
>>> put it under
>>> generic directory but enabling it on x86 only initially. If other
>>> targets
>>> want and start
>>> to support similar features like x86 on weak symbol, then they can be
>>> enabled seperately.
>>> This looks to me is a more clean & acceptable way to other targets.
>>>
>> 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.
--
H.J.