This is the mail archive of the binutils@sources.redhat.com 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]

a problem with ld options


Hi, everyone
  I'm encoutering a problem with ld.
  First, I compile and link my program as follows:
  gcc -Wl,-r -Wl,-d -static try.c -o try.o
  ld -q try.o -o try.out
  readelf try.o -r
  readelf try.out -r
  The first readelf works well, but the second exits with segment fault.

  The little program try.c is like this:
===========================
#include <stdio.h>
int main()
{
     printf("this is just a try\n");
     return 0;
}
===========================

I try to see what causes the readelf to crash, I find that there are bad symbol indexes in relocation sections. These indexes go beyond the space of symbol table. And the offsets of the relocation entris in .rel.init, .rel.text, .rel.fini seem to be incorrect too; they all start at 10000000, which should be 4000000. I really don't know why it happens.

What's more, when I try to redirect to output of try.out by using ./try.out &> try.log, there is nothing in file try.log. The output simply could not be redirected.

The compiler I use is a cross compiler generated by gcc 3.4.1 to work on a mips platform, and the ld version is GNU ld version 2.15.

All I want to do is to create a statically linked executable file with address information, relocation information and common symbols. Then this file could be used as the input file of ALTO(A Link Time Optimizer). What's wrong with it?

BTW, if anyone happens to be dealing with ALTO too, would you please give me some advice on how to port it to a mips platform? It originally works on Alpha. And I haven't subscribed this mailing list, so please send the letter directly to my mail box. Thanks a lot.

Best Wishes
yu chen



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