This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Implement x86 SIZE32/SIZE64 relocations
On Wed, Jan 16, 2013 at 12:58 PM, David Miller <davem@davemloft.net> wrote:
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Wed, 16 Jan 2013 12:56:07 -0800
>
>> On Wed, Jan 16, 2013 at 12:39 PM, David Miller <davem@davemloft.net> wrote:
>>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>> Date: Wed, 16 Jan 2013 12:24:19 -0800
>>>
>>>> On Wed, Jan 16, 2013 at 12:14 PM, David Miller <davem@davemloft.net> wrote:
>>>>> GLIBC dynamic linker support is the one that needs the largest amount
>>>>> of lead time, and the one for which it is the most difficult for a
>>>>> developer or use to integrate into their environment on their own.
>>>>>
>>>>> This even applies to the person who writes the binutils support for
>>>>> emitting the relocations themselves.
>>>>
>>>> David, do you plan to add Sparc size relocation support to gas and
>>>> ld? I choose "@SIZE" to indicate size relocation. I will add both
>>>> gas and ld tests for them.
>>>
>>> Yes I do.
>>>
>>> I intend to use whatever syntax Sun's assembler uses.
>>>
>>> Sun's assembler supports the x86 size relocations as well.
>>
>> What does Sum assembler use for size relocations?
>> I couldn't find an example.
>
> Neither could I, as usual Oracle/Sun's documentation in this area is
> very poor.
>
> I'm asking one of my Oracle/Sun contacts.
If Solaris doesn't define it, I propose @SIZE:
.text
movl $xxx@SIZE, %eax
movl $xxx@SIZE - 8, %eax
movl $xxx@SIZE + 8, %eax
movl $yyy@SIZE, %eax
movl $yyy@SIZE - 16, %eax
movl $yyy@SIZE + 16, %eax
movl $zzz@SIZE, %eax
movl $zzz@SIZE - 32, %eax
movl $zzz@SIZE + 32, %eax
.comm zzz,429496729,32
.bss
.global yyy
.type yyy,%object
.size yyy,30
yyy:
.zero 30
.data
.global xxx
.type xxx,%object
.size xxx,80
xxx:
.zero 80
.long xxx@SIZE - 1
.long yyy@SIZE + 2
.long zzz@SIZE
which leads to
Relocation section '.rela.text' at offset 0x2e0 contains 9 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000001 00000420 R_X86_64_SIZE32 00000000 xxx + 0
00000006 00000420 R_X86_64_SIZE32 00000000 xxx - 8
0000000b 00000420 R_X86_64_SIZE32 00000000 xxx + 8
00000010 00000520 R_X86_64_SIZE32 00000000 yyy + 0
00000015 00000520 R_X86_64_SIZE32 00000000 yyy - 10
0000001a 00000520 R_X86_64_SIZE32 00000000 yyy + 10
0000001f 00000620 R_X86_64_SIZE32 00000020 zzz + 0
00000024 00000620 R_X86_64_SIZE32 00000020 zzz - 20
00000029 00000620 R_X86_64_SIZE32 00000020 zzz + 20
Relocation section '.rela.data' at offset 0x34c contains 3 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000050 00000420 R_X86_64_SIZE32 00000000 xxx - 1
00000054 00000520 R_X86_64_SIZE32 00000000 yyy + 2
00000058 00000620 R_X86_64_SIZE32 00000020 zzz + 0
How does it look?
--
H.J.