bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/990] New: debug symbols error


From: qunyingpan at yahoo dot com
Subject: [Bug ld/990] New: debug symbols error
Date: 2 Jun 2005 05:59:01 -0000

The debug informations (source file and line #) are messed up when ld links
object files. The ld version for this test is 2.16.90.0.3 (20050510)

Here is the test case

(1) test files

//test1.c
static int test1_v1;
static int test1_v2;
static int test1_v3;
int main(void)
{
  return 0;
}

//test2.c
static int test2_f1(int val)
{
  return val;
}

static int test2_f2(int val)
{
  return val;
}

(2) test procedure

$ gcc -g -c test1.c -o test1.o
$ gcc -g -c test2.c -o test2.o
$ ld -r -o tt.o test2.o test1.o

$ nm -l test1.o
00000000 T main         /home/test/test1.c:5
00000000 b test1_v1     /home/test/test1.c:5
00000004 b test1_v2     /home/test/test1.c:5
00000008 b test1_v3     /home/test/test1.c:5

$ nm -l test2.o
00000000 t test2_f1     /home/test/test2.c:2
00000008 t test2_f2     /home/test/test2.c:7

$ nm -l tt.o
00000010 T main         /home/test/test1.c:5
00000000 b test1_v1     /home/test/test2.c:2 <--wrong!
00000004 b test1_v2     /home/test/test2.c:3 <--wrong!
00000008 b test1_v3     /home/test/test2.c:7 <--wrong!
00000000 t test2_f1     /home/test/test2.c:2
00000008 t test2_f2     /home/test/test2.c:7


But if we change the object file order then we won't
see the problem.

$ ld -r -o tt.ok.o test1.o test2.o

$nm -l tt.ok.o
00000000 T main         /home/test/test1.c:5
00000000 b test1_v1     /home/test/test1.c:5 <--ok
00000004 b test1_v2     /home/test/test1.c:5 <--ok
00000008 b test1_v3     /home/test/test1.c:5 <--ok
00000018 t test2_f1     /home/test/test2.c:2
00000020 t test2_f2     /home/test/test2.c:7

The problem will also be gone if we don't have "-r" in
ld command.

-- 
           Summary: debug symbols error
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: qunyingpan at yahoo dot com
                CC: bug-binutils at gnu dot org,george at mvista dot
                    com,nickc at redhat dot com,qunyingpan at yahoo dot com
 GCC build triplet: x86-pentium3
  GCC host triplet: x86-pentium3
GCC target triplet: x86-pentium3


http://sources.redhat.com/bugzilla/show_bug.cgi?id=990

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]