This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Regrading the .data.rel.local section size on x86-64.
- From: Umesh Kalappa <umesh dot kalappa0 at gmail dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 20 Mar 2017 21:45:02 +0530
- Subject: Re: Regrading the .data.rel.local section size on x86-64.
- Authentication-results: sourceware.org; auth=none
- References: <CAGfacvR_=weYV8iVJk6MntuPr27vyQ3vdMUuckPFK8251BSVaA@mail.gmail.com> <mvmziggt3ad.fsf@suse.de>
Hi Andreas,
Appreciate your input here and thank you very much and please
consider the below case
.file "test.c"
.text
.Ltext0:
.section .data.i,"aw",@progbits
.align 4
.type i, @object
.size i, 4
i:
.long 10
.section .data.rel.local.qslab_reg_names,"aw",@progbits
.align 32
.type qslab_reg_names, @object
.size qslab_reg_names, 128
qslab_reg_names:
.section .rodata
.LC0:
.string "FPGALIB_GPIO_ID_QSLAB_LOS"
.quad .LC0+16
.long 736
.zero 4
.LC1:
.string "FPGALIB_GPIO_ID_QSLAB_LOL0"
.quad .LC1+16
.long 737
.zero 4
and then objdump
$objdump -x test.o | more
test.o: file format elf64-x86-64
test.o
architecture: i386:x86-64, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x0000000000000000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 0000000000000000 0000000000000000 00000040 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 0000000000000000 0000000000000000 00000040 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 0000000000000000 0000000000000000 00000040 2**2
ALLOC
3 .data.i 00000004 0000000000000000 0000000000000000 00000040 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .data.rel.local.qslab_reg_names 00000000 0000000000000000
0000000000000000 00000060 2**5
CONTENTS, ALLOC, LOAD, DATA
5 .rodata 0000013e 0000000000000000 0000000000000000 00000060 2**0
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
6 .text.bar 0000000d 0000000000000000 0000000000000000 0000019e 2**0
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
here the data.i section inherits its size from "i" type. and note that
the .s was generated by compiler(not the hand written).
requirement here is that ,we want the section
".data.rel.local.qslab_reg_names" size to inherit from
qslab_reg_names object size like "data.i" section .
Any comments here ?
Thank you
~Umesh
On Mon, Mar 20, 2017 at 8:15 PM, Andreas Schwab <schwab@suse.de> wrote:
> On Mär 20 2017, Umesh Kalappa <umesh.kalappa0@gmail.com> wrote:
>
>> Here is the asm sample like
>>
>> .file "test.c"
>> .text
>> .Ltext0:
>> .section .data.rel.local.qslab_reg_names,"aw",@progbits
>> .align 32
>> .type qslab_reg_names, @object
>> .size qslab_reg_names, 128
>> qslab_reg_names:
>> .section .rodata
>> .LC0:
>> .string "FPGALIB_GPIO_ID_QSLAB_LOS"
>> .quad .LC0+16
>> .long 736
>> .zero 4
>> .LC1:
>> .string "FPGALIB_GPIO_ID_QSLAB_LOL0"
>> .quad .LC1+16
>> .long 737
>> .zero 4
>> .LC2:
>> .string "FPGALIB_GPIO_ID_QSLAB_LOL1"
>> .quad .LC2+16
>> .long 738
>> .zero 4
>> .LC3:
>> .string "FPGALIB_GPIO_ID_QSLAB_LOL2"
>> .quad .LC3+16
>> .long 739
>>
>> the .data.rel.local.qslab_reg_names section size ,is 128 bytes ,where
>> the qslab_reg_names is the only object in the secttion.
>
> The .size directive does not modify the size of the section, it only
> sets the size attribute of the symbol. Since the section has no
> contents, it remains empty. If you want to fill it with zeroes, use the
> .zero directive.
>
> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."