some question about output section

loody miloody@gmail.com
Wed May 4 15:51:00 GMT 2011


hi all:

2011/5/1 loody <miloody@gmail.com>:
> 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.
>>
Below I excerpt the content of the document
‘archive:file’
 matches file within archive
‘archive:’
 matches the whole archive

And I make 2 links script to link all the *.o files below link_folder
1.
OUTPUT_ARCH(mips)
SECTIONS
{
  .onlyText 0x80000000 :{ link_folder:*.o (.text) }
}
ld tell me he cannot find "input files" by this script
 mipsel-linux-gnu-ld -Bstatic -T ./link.xn -o TEST_LINK.elf -Map
TEST_LINK.map --oformat elf32-tradlittlemips
 mipsel-linux-gnu-ld: no input files


2,
OUTPUT_ARCH(mips)
 SECTIONS
 {
  .onlyText 0x80000000 :  { link_folder: (.text)  }
 }
ld can successfully generate elf file for me, but I cannot see the
output section I give in script.

Below are the contents of ./link_folder
# ls link_folder/ -lht
 total 12K
 -rw-r--r-- 1 root root 4.8K 2011-05-04 21:29 file1.o
 -rw-r--r-- 1 root root 3.7K 2011-05-04 21:29 main.o
#

My questions are:
1. in document, it say "Either one or both of `archive' and `file' can
contain shell wildcards." In my script1, I wrote the 'file' part to
meet all *.o files. Why ld told me he cannot find them?

2. in script2, I follow the rule " `archive:' matches the whole
archive". So ld doesn't tell me he cannot find them, But why final elf
still don't include the section I wrote in script, furthermore, the
elf doesn't any .text .data .bss secion.

3. I think "lib1.a:" is not the correct usage to tell ld to search for
the object files content in lib1.a, since lib1.a is not an archive,
right? (I thought archive here in document means real folder)

appreciate your kind help,
miloody



More information about the Binutils mailing list