public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/48200] New: linking shared library with LTO results in different exported symbols
@ 2011-03-19  2:21 zeev.tarantov at gmail dot com
  2011-03-21 13:12 ` [Bug lto/48200] " rguenth at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: zeev.tarantov at gmail dot com @ 2011-03-19  2:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200

           Summary: linking shared library with LTO results in different
                    exported symbols
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zeev.tarantov@gmail.com


The library is libpci.so.3.1.7, released 2010-01-31, part of every linux
distro.
Homepage is: http://mj.ucw.cz/pciutils.html, source repository is:
http://www.kernel.org/git/?p=utils/pciutils/pciutils.git;a=shortlog

Object files compiled with CFLAGS: "-O2 -fPIC -Wall -Wno-parentheses
-Wstrict-prototypes -Wmissing-prototypes -flto".

If linked with: gcc -shared -Wl,-O1 -Wl,--as-needed -Wl,-soname,libpci.so.3
-Wl,--version-script=libpci.ver -o libpci.so.3.1.7 init.o access.o generic.o
dump.o names.o filter.o names-hash.o names-parse.o names-net.o names-cache.o
params.o caps.o sysfs.o proc.o i386-ports.o  -lz -lresolv

Then (as expected): objdump -T libpci.so.3.1.7 | grep pci_fill_info
00000000000032f0 g    DF .text  000000000000006c (LIBPCI_3.0) pci_fill_info
00000000000032f0 g    DF .text  000000000000006c  LIBPCI_3.1  pci_fill_info

But if linked with LTO: gcc -shared -Wl,-O1 -Wl,--as-needed -Wl,-flto
-Wl,-soname,libpci.so.3 -Wl,--version-script=libpci.ver -o libpci.so.3.1.7
init.o access.o generic.o dump.o names.o filter.o names-hash.o names-parse.o
names-net.o names-cache.o params.o caps.o sysfs.o proc.o i386-ports.o  -lz
-lresolv

Then: objdump -T libpci.so.3.1.7 | grep pci_fill_info

No such symbol.

gcc (Gentoo SVN) 4.6.0-pre9999 20110318 (prerelease) rev. 171169
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU ld (Linux/GNU Binutils) 2.21.51.0.7.20110306
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

I don't know enough to tell whether the problem is in pciutils, binutils or
gcc. If this is invalid and I'm just spamming, I apologize. Please kindly point
me in the right direction to fix this issue.

Preproccessed source is (relevant parts):

int pci_fill_info(struct pci_dev *, int flags)
__attribute__((visibility("default")));
# 170 "pci.h"

int pci_fill_info_v30(struct pci_dev *, int flags)
__attribute__((visibility("default")));
int pci_fill_info_v31(struct pci_dev *, int flags)
__attribute__((visibility("default")));


int
pci_fill_info_v31(struct pci_dev *d, int flags)
{
  if (flags & 0x10000)
    {
      flags &= ~0x10000;
      d->known_fields = 0;
      pci_free_caps(d);
    }
  if (flags & ~d->known_fields)
    d->known_fields |= d->methods->fill_info(d, flags & ~d->known_fields);
  return d->known_fields;
}


;
extern int pci_fill_info_v30(struct pci_dev *d, int flags)
__attribute__((alias("pci_fill_info_v31")));
asm(".symver " "pci_fill_info_v30" "," "pci_fill_info@LIBPCI_3.0");
asm(".symver " "pci_fill_info_v31" "," "pci_fill_info@@LIBPCI_3.1");


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-01-09  0:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-19  2:21 [Bug lto/48200] New: linking shared library with LTO results in different exported symbols zeev.tarantov at gmail dot com
2011-03-21 13:12 ` [Bug lto/48200] " rguenth at gcc dot gnu.org
2011-03-21 18:27 ` zeev.tarantov at gmail dot com
2011-03-21 19:24 ` zeev.tarantov at gmail dot com
2011-03-22  0:14 ` zeev.tarantov at gmail dot com
2011-03-22 10:17 ` rguenth at gcc dot gnu.org
2011-03-22 10:19 ` rguenth at gcc dot gnu.org
2011-03-23  0:21 ` hubicka at ucw dot cz
2011-03-23 10:17 ` rguenth at gcc dot gnu.org
2011-03-23 13:25 ` hubicka at ucw dot cz
2014-06-16 14:28 ` khimov at altell dot ru
2014-08-05  7:19 ` amodra at gmail dot com
2020-04-15 12:46 ` [Bug lto/48200] Implement function attribute for symbol versioning (.symver) mark at gcc dot gnu.org
2020-05-06 13:45 ` hubicka at gcc dot gnu.org
2021-01-04  9:41 ` mark at gcc dot gnu.org
2021-08-30  4:35 ` pinskia at gcc dot gnu.org
2021-08-30  4:37 ` pinskia at gcc dot gnu.org
2022-01-09  0:37 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).