This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Puzzle about .rel.dyn section generated for mips elf target executables
- From: "Amker.Cheng" <amker dot cheng at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 13 Jul 2010 16:41:21 +0800
- Subject: Puzzle about .rel.dyn section generated for mips elf target executables
Hi :
Giving a simple example, which consists of test.c and test.xn
--------------------------------------------------------test.c start
int x11;
int *xxp = &x11;
int main()
{
return *xxp;
}
--------------------------------------------------------test.c end
--------------------------------------------------------test.xn start
OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips",
"elf32-tradlittlemips")
OUTPUT_ARCH(mips)
ENTRY(main)
SECTIONS
{
.text 0xb4060000:
{
*(.text);
*(.rodata);
}
.data :
{
_fdata = . ;
*(.data .data.* .gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
SORT(CONSTRUCTORS)
}
_gp = ALIGN(16) + 0x7ff0;
.got : { *(.got.plt) *(.got) }
.sdata :
{
*(.sdata .sdata.* .gnu.linkonce.s.*)
}
.sbss :
{
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
}
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
}
}
--------------------------------------------------------test.xn end
build by command lines like:
mipsel-sde-elf-gcc -march=mips1 -O2 -c -EL -G0 test.c -o test.o
mipsel-sde-elf-ld -EL -G0 test.o -T test.xn -o a.out
checking sections in a.out by
mipsel-sde-elf-readelf -S a.out
outputs captured as following:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS b4060000 010000 000018 00 AX 0 0 4
[ 2] .rel.dyn REL b4060018 010018 000010 08 A 0 0 4
^------------------------- Please attention
[ 3] .data PROGBITS b4060028 010028 000004 00 WA 0 0 4
[ 4] .bss NOBITS b406002c 01002c 000004 00 WA 0 0 4
[ 5] .reginfo MIPS_REGINFO 00000000 01002c 000018 18 0 0 4
[ 6] .pdr PROGBITS 00000000 010044 000020 00 0 0 4
[ 7] .comment PROGBITS 00000000 010064 000012 00 0 0 1
[ 8] .gnu.attributes LOOS+ffffff5 00000000 010076 000010 00 0 0 1
[ 9] .shstrtab STRTAB 00000000 010086 00005c 00 0 0 1
[10] .symtab SYMTAB 00000000 0102c4 0000f0 10 11 10 4
[11] .strtab STRTAB 00000000 0103b4 000020 00 0 0 1
Though relocation in .rel.dyn are all REL_MIPS_NONE, I'm wondering
why .rel.dyn section is generated for this simple elf target executable?
Does it necessary?
BTW, i am testing on GCC4.4.1 and BINUTILS-2.19.51 configure as mipsel-sde-elf
both including my own modification, which would never affect this testcase.
any explanation? Thanks in advance.
--
Best Regards.