bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/27441] Small inconsistency in between gold and bfd


From: matz at suse dot de
Subject: [Bug ld/27441] Small inconsistency in between gold and bfd
Date: Tue, 23 Feb 2021 16:28:17 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27441

Michael Matz <matz at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|ccoutant at gmail dot com          |unassigned at 
sourceware dot org
          Component|gold                        |ld

--- Comment #3 from Michael Matz <matz at suse dot de> ---
So, like this:

% cat lib1.c
int func1(void) { return 1; }
int func2(void) { return 2; }

% cat lib2.c
int __attribute__((weak)) func1(void) { return 3; }

% cat bad4.c
extern int func1(void);
extern int func2(void);

int callthem(void)
{
  return func1() + func2();
}

% gcc -fPIC -shared -o lib1.so lib1.c
% gcc -fPIC -shared -o lib2.so lib2.c
% gcc -fPIC -Wl,--as-needed -fno-lto -shared -o good.so  bad4.c -L. -l2 -l1
% readelf-dW good.so | grep lib
 0x0000000000000001 (NEEDED)             Shared library: [lib2.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib1.so]

% gcc -fPIC -Wl,--as-needed -flto -shared -o bad.so  bad4.c -L. -l2 -l1
% readelf -dW bad.so | grep lib
 0x0000000000000001 (NEEDED)             Shared library: [lib1.so]

(I'm resetting component to ld again, as I think the above shows the problem
clearly enough.  It's still possible that it's the gcc LTO plugin at fault,
though)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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