Bug 2279170

Summary: clang-18: -ffat-lto-objects gives multiple definition of `.str.llvm.0'
Product: [Fedora] Fedora Reporter: Hin-Tak Leung <htl10>
Component: clangAssignee: Tom Stellard <tstellar>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: airlied, jchecahi, kkleine, npopov, sergesanspaille, siddharth.kde, tbaeder, tstellar, tuliom
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-04-25 10:48:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hin-Tak Leung 2024-05-05 17:46:35 UTC
Doing:

clang++ -flto -ffat-lto-objects -shared  -fPIC -DPIC ...

gives

/usr/bin/ld: /tmp/lto-llvm-8916fe.o:(.rodata.str1.1+0x2e0): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-6b4bd2.o:(.rodata.str1.1+0x1c): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-5d650b.o:(.rodata.str1.1+0x192): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-f629d0.o:(.rodata.str1.1+0x38): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-3268c9.o:(.rodata.str1.1+0x0): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-f0e820.o:(.rodata.str1.1+0x0): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-b5dd56.o:(.rodata.str1.1+0x0): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-c819be.o:(.rodata.str1.1+0x15): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-dd4627.o:(.rodata.str1.1+0x2c): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-0eb806.o:(.rodata.str1.1+0x63): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-ccbdf8.o:(.rodata.str1.1+0x0): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-2885f6.o:(.rodata.str1.1+0x12): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-db3b4f.o:(.rodata.str1.1+0x2d7): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
/usr/bin/ld: /tmp/lto-llvm-9fa0cf.o:(.rodata.str1.1+0x11): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
clang++: error: linker command failed with exit code 1 (use -v to see invocation)


with:
clang-18.1.1-1.fc40.x86_64


Reproducible: Always

Steps to Reproduce:
1. uses "clang++ -flto -ffat-lto-objects -shared  -fPIC -DPIC ..." to build shared libraries

Actual Results:  
/usr/bin/ld: /tmp/lto-llvm-9fa0cf.o:(.rodata.str1.1+0x11): multiple definition of `.str.llvm.0'; /tmp/lto-llvm-6f7958.o:(.rodata.str1.1+0x31d): first defined here
clang++: error: linker command failed with exit code 1 (use -v to see invocation)


Expected Results:  
success (it was successful with fc39's clang before I ugraded to fc40)

Upstream issue:
https://github.com/llvm/llvm-project/issues/84167

Apparently somebody from redhat filed it, and it got fixed, and there is a koji build for fc41. Please backport to fc40.

Comment 1 Nikita Popov 2024-05-06 01:00:31 UTC
I've put up https://src.fedoraproject.org/rpms/clang/pull-request/238 to backport just this patch. Though if @tstellar is planning to do a point release update for f40 soon, that would fix it as well.

Comment 2 Aoife Moloney 2025-04-25 10:37:09 UTC
This message is a reminder that Fedora Linux 40 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 40 on 2025-05-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '40'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 40 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Nikita Popov 2025-04-25 10:48:09 UTC
This has been fixed a long time ago, closing.