This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: some question about output section


hi:
Thanks for your kind hint :-)

2011/4/29 Alan Modra <amodra@gmail.com>:
> On Fri, Apr 29, 2011 at 12:17:18AM +0800, loody wrote:
>> after studying the ld info
>
> Study some more. ?Also review when ld extracts elements from archives.
>
after studying the section 3.6.4.1 about specifying files in the
archives by writing a pattern.
I changed my ld script as below and put some object files below link_folder:

OUTPUT_ARCH(mips)
ENTRY(entry)
SECTIONS
{
  .begin 0xbfb00000 :
  {
        *(.begin)
        . = ALIGN(8);
        _end_begin = ABSOLUTE(.);
  }
  .onlyText 0x80000000 : /*AT(_end_begin)*/
  {
        link_folder: (*.text)
        lib1.a:(*.text)
  }
  .wholelib 0x81000000 :
  {
     lib2.a:
  }
  .text : { *(EXCLUDE_FILE (*.a ) .text)}
  .data : { *(EXCLUDE_FILE (*.a ) .data) }
}

# ls link_folder/ -lht
total 12K
-rw-r--r-- 1 root root 4.8K 2011-05-01 20:42 file1.o
-rw-r--r-- 1 root root 3.7K 2011-05-01 20:42 main.o
#


I still cannot find the section name, onlyText and wholelib, in my elf
content with link command as below:
mipsel-linux-gnu-ld -T ./link.xn -o TEST_LINK.elf -Map TEST_LINK.map
--oformat elf32-tradlittlemips lib1.a lib2.a  file1.o main.o

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .begin            PROGBITS        bfb00000 010000 000070 00  AX  0   0  4
  [ 2] .text             PROGBITS        bfb00070 010070 0002a0 00  AX  0   0 16
  [ 3] .reginfo          MIPS_REGINFO    bfb00310 010310 000018 18   A  0   0  4
  [ 4] .rodata           PROGBITS        bfb00330 010330 000020 00   A  0   0 16
  [ 5] .rodata.str1.4    PROGBITS        bfb00350 010350 000014 01 AMS  0   0  4
  [ 6] .bss              NOBITS          bfb00370 010364 000010 00  WA  0   0 16
  [ 7] .pdr              PROGBITS        00000000 010364 0000a0 00      0   0  4
  [ 8] .comment          PROGBITS        00000000 010404 00007a 00      0   0  1
  [ 9] .gnu.attributes   LOOS+ffffff5    00000000 01047e 000010 00      0   0  1
  [10] .debug_abbrev     MIPS_DWARF      00000000 01048e 000161 00      0   0  1
  [11] .debug_info       MIPS_DWARF      00000000 0105ef 0001eb 00      0   0  1
  [12] .debug_line       MIPS_DWARF      00000000 0107da 0000d0 00      0   0  1
  [13] .debug_frame      MIPS_DWARF      00000000 0108ac 000080 00      0   0  4
  [14] .debug_loc        MIPS_DWARF      00000000 01092c 00019c 00      0   0  1
  [15] .debug_pubnames   MIPS_DWARF      00000000 010ac8 000083 00      0   0  1
  [16] .debug_aranges    MIPS_DWARF      00000000 010b4b 000040 00      0   0  1
  [17] .debug_str        MIPS_DWARF      00000000 010b8b 000141 01  MS  0   0  1
  [18] .debug_ranges     MIPS_DWARF      00000000 010ccc 000018 00      0   0  1
  [19] .shstrtab         STRTAB          00000000 010ce4 0000e1 00      0   0  1
  [20] .symtab           SYMTAB          00000000 011138 0001d0 10     21  23  4
  [21] .strtab           STRTAB          00000000 011308 00007d 00      0   0  1
Key to Flags:

-- 
Regards,
miloody


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]