Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 863266 - sci-mathematics/twelf-1.7.1-r2 fails to compile if it or dev-lang/mlton is built with LTO: ld: ccsV38HC.ltrans0.ltrans.o: relocation R_X86_64_32 against hidden symbol `globalCPointer' can not be used when making a PIE object
Summary: sci-mathematics/twelf-1.7.1-r2 fails to compile if it or dev-lang/mlton is bu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2022-08-03 07:01 UTC by Agostino Sarubbo
Modified: 2024-09-10 01:37 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,610.95 KB, text/plain)
2022-08-03 07:01 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-08-03 07:01:24 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: sci-mathematics/twelf-1.7.1-r2 fails to compile (lto).
Discovered on: amd64 (internal ref: lto_tinderbox)

NOTE:
This machine uses lto with CFLAGS=-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Here is a bit of explanation:

-Werror=lto-type-mismatch:
User to find possible runtime issues in packages. It likely means the package is unsafe to build & use with LTO.
For projects using the same identifier but with different types across different files, they must be fixed to be consistent across the codebase.

-Werror=odr:
Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO. C++ code must comply with the One Definition Rule (ODR) - see https://en.cppreference.com/w/cpp/language/definition#One_Definition_Rule.

-Werror=strict-aliasing:
Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO.

Workarounds:
- If upstream is friendly and still active, file a bug upstream. For emulators, codecs, games, or multimedia packages, it may be worth just applying a workaround instead, as upstreams sometimes aren't receptive to these bugs (VALID FOR ALL).
- Use the new 'filter-lto' from flag-o-matic.eclass as it's likely to be unsafe with LTO (VALID FOR lto-type-mismatch - odr).
- Fix it yourself if interested, of course (VALID FOR ALL).
- Append-flags -fno-strict-aliasing (VALID FOR strict-aliasing).
- Use memcpy() but a union is sometimes suitable too (VALID FOR strict-aliasing).
- -fstrict-aliasing is implied by -O2, so this must be addressed in some form (VALID FOR strict-aliasing).

See also: https://marc.info/?l=gentoo-dev&m=165639574126280&w=2
Comment 1 Agostino Sarubbo gentoo-dev 2022-08-03 07:01:27 UTC
Created attachment 797137 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-08-03 07:01:30 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:


	echo; echo "Error: MLton >= 20041109 required";	echo;	\n
collect2: error: ld returned 1 exit status
Comment 3 Eli Schwartz gentoo-dev 2024-08-21 16:21:12 UTC
works ok if I add filter-lto to mlton *and* twelf.


With twelf built using LTO, you get:

/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/cckg2y3k.ltrans0.ltrans.o: relocation R_X86_64_32 against hidden symbol `globalCPointer' can not be used when making a PIE object
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
unhandled exception: Fail: call to system failed with Fail: exit status 1:
gcc -o bin/twelf-server /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileksRB7F.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileTijRw5.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filekI5rfr.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filemfgIl9.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileONvtKN.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file6fizYL.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileLKCPix.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileguBrUx.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileUSacqd.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileArznUs.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filecImYrr.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filekYniqY.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file3PJHf9.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file8jksxN.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filecbgVgW.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file6ZCNs7.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileay93M4.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileN0khTW.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileM2cxNI.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file1xIXCW.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file2AeujH.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file6cBKKg.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filewHsxe9.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filekSggh8.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileb7VA7Z.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileQxobpx.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileYN2KC3.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileU3oNFT.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filekbiceV.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileAfdXlW.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileGR02xX.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file4uBpCy.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileSDeTHe.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file2YGdjf.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileCZvhZz.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file0or4w5.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filehaw40j.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileXdDVLL.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileoeGWpv.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileBHJwm0.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileUW4Trt.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileRp6sQV.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filel2TXLE.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file1hUYY5.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileJZhNnA.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileIFO1AR.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file8uadeD.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file0iPNjq.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/filedPqYii.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/file0PvM4o.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileO7mpQj.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileE0b8Ki.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileGXyLPk.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileFWS1Hl.o /var/tmp/portage/sci-mathematics/twelf-1.7.1-r2/temp/fileyfk8Q7.o -L/usr/lib64/mlton/lib/mlton/targets/self -lmlton-pic -lgdtoa-pic -lm -lgmp -L/lib64 -m64 -Wl,-znoexecstack -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -fno-PIE
make: *** [Makefile:59: twelf-server-mlton] Error 1


With just mlton, you get:

"relocation R_X86_64_32 against `.rodata.str1.1' can not be used"
Comment 4 Larry the Git Cow gentoo-dev 2024-09-10 01:37:27 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9709c3e5dd9a4fe6d398f8c1cfbf48b649efd440

commit 9709c3e5dd9a4fe6d398f8c1cfbf48b649efd440
Author:     Eli Schwartz <eschwartz@gentoo.org>
AuthorDate: 2024-09-09 03:58:21 +0000
Commit:     Eli Schwartz <eschwartz@gentoo.org>
CommitDate: 2024-09-10 01:04:12 +0000

    sci-mathematics/twelf: mark as LTO-unsafe
    
    Per the contributing guideline:
    
    > Twelf, the software, is not under active development, and changes to
    > the code of Twelf are unlikely to be accepted unless you’re working with
    > Twelf’s original authors, Frank Pfenning and Carsten Schürmann.
    
    Getting this fixed is unlikely to happen, so all that's left is
    filtering.
    
    Closes: https://bugs.gentoo.org/863266
    Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>

 sci-mathematics/twelf/twelf-1.7.1-r2.ebuild | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=698e17aad2e95f56c53fc3139f45c03c33126edb

commit 698e17aad2e95f56c53fc3139f45c03c33126edb
Author:     Eli Schwartz <eschwartz@gentoo.org>
AuthorDate: 2024-09-09 04:20:48 +0000
Commit:     Eli Schwartz <eschwartz@gentoo.org>
CommitDate: 2024-09-10 01:04:12 +0000

    dev-lang/mlton: mark as LTO-unsafe
    
    It does something to mess with twelf's codegen. Assume it is too flaky
    to handle LTO.
    
    Bug: https://bugs.gentoo.org/863266
    Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>

 dev-lang/mlton/mlton-20180207.ebuild | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)