bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/6877] New: Inconsistent treatment of common and text


From: hjl dot tools at gmail dot com
Subject: [Bug ld/6877] New: Inconsistent treatment of common and text
Date: 10 Sep 2008 22:03:47 -0000

address@hidden common2]$ cat foo.c
void foo (void) { }
address@hidden common2]$ cat main.c
#include <stdio.h>

#ifdef FOO
int foo = FOO;
#else
int foo;
#endif

int
main ()
{
  printf ("foo: %d\n", foo);
  foo = 200; 
  printf ("foo: %d\n", foo);
  return 0;
}
address@hidden common2]$ make
gcc -g -fPIC -c foo.c
gcc -shared -o libfoo.so foo.o
gcc -c -o main1.o -g main.c
gcc -o foo1 -B./ libfoo.so main1.o -Wl,-rpath,.
gcc -c -o main2.o -DFOO=2 -g main.c
gcc -o foo2 -B./ libfoo.so main2.o -Wl,-rpath,.
/usr/local/bin/ld: Warning: type of symbol `foo' changed from 2 to 1 in main2.o
gcc -o foo3 -B./ main1.o libfoo.so -Wl,-rpath,.
for f in foo1 foo2 foo3; do echo "Running: $f"; ./$f; \
          if [ $? != 0 ]; then echo Failed; fi; done
Running: foo1
foo: 84026879
/bin/sh: line 1: 30371 Segmentation fault      ./$f
Failed
Running: foo2
foo: 2
foo: 200
Running: foo3
foo: 0
foo: 200
address@hidden common2]$

-- 
           Summary: Inconsistent treatment of common and text
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl dot tools at gmail dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=6877

------- 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]