This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD][PATCH] Fix ARM backend's handling of protected symbol in a DSO
Both protected_1 and protected_2 fail currently on ARM.
FAIL: protected_1 (exit: 134)
=============================
protected_1: ../../../src/gold/testsuite/protected_main_1.cc:39: int main(): Ass
ertion `&f2 == get_f2_addr()' failed.
FAIL: protected_2 (exit: 134)
=============================
protected_2: ../../../src/gold/testsuite/protected_main_1.cc:39: int main(): Ass
ertion `&f2 == get_f2_addr()' failed.
On Wed, Mar 14, 2012 at 11:23 AM, Doug Kwan (關振德) <dougkwan@google.com> wrote:
> protected_1 and another protected test whose name I don't remember. I
> can run the testsuite again but it will take a while in QEMU
>
> On Wed, Mar 14, 2012 at 11:22 AM, Ian Lance Taylor <iant@google.com> wrote:
>> "Doug Kwan (關振德)" <dougkwan@google.com> writes:
>>
>>> I can changed that. The code was copied from the x86_64 backend:
>>>
>>> if (gsym->is_from_dynobj()
>>> || gsym->is_undefined()
>>> || gsym->is_preemptible()
>>> || (gsym->visibility() == elfcpp::STV_PROTECTED
>>> && parameters->options().shared())
>>> || (gsym->type() == elfcpp::STT_GNU_IFUNC
>>> && parameters->options().output_is_position_independent()))
>>> got->add_global_with_rel(gsym, GOT_TYPE_STANDARD, rela_dyn,
>>> elfcpp::R_X86_64_GLOB_DAT);
>>>
>>>
>>> The backend i386 backend also does the same. Should we change them
>>> all to use output_is_position_independent()?
>>
>> I don't know, what's the test case?
>>
>> Ian
>>
>>> On Wed, Mar 14, 2012 at 10:00 AM, Ian Lance Taylor <iant@google.com> wrote:
>>>> "Doug Kwan (關振德)" <dougkwan@google.com> writes:
>>>>
>>>>> 2012-03-14 Doug Kwan <dougkwan@google.com>
>>>>>
>>>>> * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
>>>>> dynamic relocations for protected symbols in shared objects.
>>>>>
>>>>> Index: gold/arm.cc
>>>>> ===================================================================
>>>>> RCS file: /cvs/src/src/gold/arm.cc,v
>>>>> retrieving revision 1.146
>>>>> diff -u -u -p -r1.146 arm.cc
>>>>> --- gold/arm.cc 3 Feb 2012 20:01:01 -0000 1.146
>>>>> +++ gold/arm.cc 14 Mar 2012 08:44:14 -0000
>>>>> @@ -8314,7 +8314,9 @@ Target_arm<big_endian>::Scan::global(Sym
>>>>> Reloc_section* rel_dyn = target->rel_dyn_section(layout);
>>>>> if (gsym->is_from_dynobj()
>>>>> || gsym->is_undefined()
>>>>> - || gsym->is_preemptible())
>>>>> + || gsym->is_preemptible()
>>>>> + || (gsym->visibility() == elfcpp::STV_PROTECTED
>>>>> + && parameters->options().shared()))
>>>>> got->add_global_with_rel(gsym, GOT_TYPE_STANDARD,
>>>>> rel_dyn, elfcpp::R_ARM_GLOB_DAT);
>>>>> else
>>>>
>>>>
>>>> Usually tests for whether to generate a dynamic reloc should check
>>>> parameters->options().output_is_position_independent() rather than
>>>> parameters->options().shared(). The difference is that the former is
>>>> also true for -pie.
>>>>
>>>> Ian