bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/23079] New: Multiple PREVAILING_DEF_IRONLY for a same symbol in


From: mliska at suse dot cz
Subject: [Bug ld/23079] New: Multiple PREVAILING_DEF_IRONLY for a same symbol in an archive
Date: Wed, 18 Apr 2018 08:40:01 +0000

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

            Bug ID: 23079
           Summary: Multiple PREVAILING_DEF_IRONLY for a same symbol in an
                    archive
           Product: binutils
           Version: 2.31 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
  Target Milestone: ---

Let's consider:

$ cat 1.i
int igt_subtest_jmpbuf, viewport;
$ cat 2.i
int igt_subtest_jmpbuf, viewport;

$ gcc -flto 1.i -c
$ gcc -flto 2.i -c
$ ar cru libx.la 1.o 2.o
$ ranlib libx.la

$ cat main.i
int igt_subtest_jmpbuf;
extern int viewport;
int main()
{
  return igt_subtest_jmpbuf;
}

$ gcc main.i libx.la -flto
lto1: fatal error: multiple prevailing defs for ‘viewport’
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

It's caused by fact that:

$ cat main.res
3
main.o 2
190 57d43a0e4f2e4898 PREVAILING_DEF main
194 57d43a0e4f2e4898 PREVAILING_DEF_IRONLY igt_subtest_jmpbuf
address@hidden 2
188 65b5ba79fd3c2703 PREVAILING_DEF_IRONLY viewport
190 65b5ba79fd3c2703 RESOLVED_IR igt_subtest_jmpbuf
address@hidden 2
188 253018f931e7b9de PREVAILING_DEF_IRONLY viewport
190 253018f931e7b9de RESOLVED_IR igt_subtest_jmpbuf

While ld.gold does:
$ cat main.res
cat main.res
1
main.o 2
190 f4c25c288a258244 PREVAILING_DEF main
194 f4c25c288a258244 PREVAILING_DEF_IRONLY igt_subtest_jmpbuf

If I modify main.i to:
$ cat main.i
int igt_subtest_jmpbuf;
extern int viewport;
int main()
{
  return igt_subtest_jmpbuf + viewport;
}

Then it's all fine with BFD resolution file looking as follows:

$ cat main.res
3
main.o 3
190 aa0f078bbef97098 PREVAILING_DEF main
194 aa0f078bbef97098 PREVAILING_DEF_IRONLY igt_subtest_jmpbuf
196 aa0f078bbef97098 RESOLVED_IR viewport
address@hidden 2
188 65b5ba79fd3c2703 PREVAILING_DEF_IRONLY viewport
190 65b5ba79fd3c2703 RESOLVED_IR igt_subtest_jmpbuf
address@hidden 2
188 253018f931e7b9de RESOLVED_IR viewport
190 253018f931e7b9de RESOLVED_IR igt_subtest_jmpbuf

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