Re: question about head_64.S
From: Cao jin
Date: Tue Jan 22 2019 - 23:04:50 EST
On 1/22/19 9:08 PM, Kirill A. Shutemov wrote:
> On Tue, Jan 22, 2019 at 03:31:25PM +0800, Cao jin wrote:
>> Hi, Kirll,
>>
>>> 2.
>>> Why gdt64 has following definition?:
>>>
>>> gdt64:
>>> .word gdt_end - gdt
>>> .long 0
>>> .word 0
>>> .quad 0
>>>
>>> obviously, gdt64 stores the GDTR content under x86_64, which is 10 bytes
>>> long, so why not just:
>>>
>>> gdt64:
>>> .word gdt_end - gdt
>>> .quad 0
>>>
>>> With above modification, it can boot.
>>>
>>
>> Seems you introduced gdt64 code in commit beebaccd50, could you help
>> with this question?
>
> Looks like you are right. I've got confused at some point.
>
> Could you prepare a patch?
Sure.
>
>> And it also remind me of another question about adjust_got which is also
>> introduced by you. Because I failed to construct a test environment with
>> ld version less than 2.24 until now, so I wanna do a quick ask here:
>> does it make sense to adjust GOT from the 4th entry of it? Because as I
>> know, the first 3 entries are special one, which (I guess) will be not used.
>
> No.
>
> These 3 entries are reserved for a special symbols (like entry 0 for
> _DYNAMIC). It means linker should not use these entries for normal
> symbols, but it doesn't mean that they don't need to be adjusted during
> the load.
>
Thanks for your info! BTW, could I know how you construct the test
environment?
I tried centos6, the GCC version is too old to compile; then tried
fedora28 with binutils-2.20.51.0.2-5.48.el6.x86_64.rpm from centos6, ld
reported errors; and then tried compiling binutils source with tag 2.23,
stopped at configure phase:(
--
Sincerely,
Cao jin