[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/19719] New: Mixing PIC and non-PIC input files generates unexpec
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/19719] New: Mixing PIC and non-PIC input files generates unexpected result |
Date: |
Wed, 24 Feb 2016 14:44:56 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=19719
Bug ID: 19719
Summary: Mixing PIC and non-PIC input files generates
unexpected result
Product: binutils
Version: 2.27 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
Target: x86
address@hidden weak-4]$ cat foo.c
extern int __attribute__ ((weak)) fun (void);
int
foo (void)
{
if (&fun != 0)
return fun ();
return 0;
}
address@hidden weak-4]$ cat bar.c
extern int __attribute__ ((weak)) fun (void);
int
bar (void)
{
if (&fun != 0)
return fun ();
return 0;
}
address@hidden weak-4]$ cat main.c
#include <stdlib.h>
extern int foo (void);
extern int bar (void);
int
main (void)
{
if (foo () != bar ())
abort ();
return 0;
}
address@hidden weak-4]$ cat fun1.c
/* Dummy */
address@hidden weak-4]$ cat fun2.c
int
fun (void)
{
return 20;
}
address@hidden weak-4]$ make
gcc -B./ -O2 -c -o foo.o foo.c
gcc -B./ -O2 -fPIC -c -o bar.o bar.c
gcc -B./ -O2 -c -o main.o main.c
gcc -B./ -shared -Wl,-soname,libfun.so -fPIC -O2 -o libfun1.so fun1.c
gcc -B./ -shared -Wl,-soname,libfun.so -fPIC -O2 -o libfun2.so fun2.c
ln -sf libfun1.so libfun.so
gcc -B./ -O2 -o x foo.o bar.o main.o libfun.so -Wl,-R,.
ln -sf libfun1.so libfun.so
./x
ln -sf libfun2.so libfun.so
./x
Makefile:20: recipe for target 'all' failed
make: *** [all] Aborted
address@hidden weak-4]$
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/19719] New: Mixing PIC and non-PIC input files generates unexpected result,
hjl.tools at gmail dot com <=