Bug 97787 - [11/12/13/14 regression] 64bit mips lto: .symtab local symbol at index x (>= sh_info of y)
Summary: [11/12/13/14 regression] 64bit mips lto: .symtab local symbol at index x (>= ...
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 10.2.0
: P2 normal
Target Milestone: 11.5
Assignee: Jan Hubicka
URL:
Keywords: lto
Depends on:
Blocks:
 
Reported: 2020-11-10 20:09 UTC by Adrian Bunk
Modified: 2023-07-07 10:38 UTC (History)
9 users (show)

See Also:
Host:
Target: mips64el-unknown-linux-gnuabi64
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-04-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Bunk 2020-11-10 20:09:33 UTC
https://buildd.debian.org/status/fetch.php?pkg=dolfin&arch=mips64el&ver=2019.2.0~git20200629.946dbd3-4&stamp=1604936169&raw=0

/usr/bin/c++ -fPIC -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -isystem /<<PKGBUILDDIR>>/debian/tmp/usr/include -DVERSION_INFO=\"2019.2.0.dev0\" -O3 -DNDEBUG -flto -Wl,-z,relro -shared -Wl,-soname,cpp.cpython-38-mips64el-linux-gnuabi64.so -o ../lib.linux-mips64-3.8/dolfin/cpp.cpython-38-mips64el-linux-gnuabi64.so CMakeFiles/cpp.dir/src/dolfin.cpp.o CMakeFiles/cpp.dir/src/parameter.cpp.o CMakeFiles/cpp.dir/src/adaptivity.cpp.o CMakeFiles/cpp.dir/src/ale.cpp.o CMakeFiles/cpp.dir/src/common.cpp.o CMakeFiles/cpp.dir/src/fem.cpp.o CMakeFiles/cpp.dir/src/function.cpp.o CMakeFiles/cpp.dir/src/generation.cpp.o CMakeFiles/cpp.dir/src/geometry.cpp.o CMakeFiles/cpp.dir/src/graph.cpp.o CMakeFiles/cpp.dir/src/log.cpp.o CMakeFiles/cpp.dir/src/math.cpp.o CMakeFiles/cpp.dir/src/mesh.cpp.o CMakeFiles/cpp.dir/src/multistage.cpp.o CMakeFiles/cpp.dir/src/ts.cpp.o CMakeFiles/cpp.dir/src/io.cpp.o CMakeFiles/cpp.dir/src/la.cpp.o CMakeFiles/cpp.dir/src/nls.cpp.o CMakeFiles/cpp.dir/src/refinement.cpp.o CMakeFiles/cpp.dir/src/MPICommWrapper.cpp.o  -Wl,-rpath,"/<<PKGBUILDDIR>>/debian/tmp/usr/lib/mips64el-linux-gnuabi64:/usr/lib/mips64el-linux-gnuabi64/hdf5/openmpi:/usr/lib/slepcdir/slepc3.14/mips64el-linux-gnuabi64-real/lib:/usr/lib/petscdir/petsc3.14/mips64el-linux-gnuabi64-real/lib:/usr/lib/mips64el-linux-gnuabi64/openmpi/lib" "/<<PKGBUILDDIR>>/debian/tmp/usr/lib/mips64el-linux-gnuabi64/libdolfin.so.2019.2.0.dev0" /usr/lib/mips64el-linux-gnuabi64/libboost_timer.so /usr/lib/mips64el-linux-gnuabi64/libboost_chrono.so /usr/lib/mips64el-linux-gnuabi64/hdf5/openmpi/libhdf5.so /usr/lib/mips64el-linux-gnuabi64/libsz.so /usr/lib/mips64el-linux-gnuabi64/libz.so /usr/lib/mips64el-linux-gnuabi64/libdl.so /usr/lib/mips64el-linux-gnuabi64/libm.so /usr/lib/slepcdir/slepc3.14/mips64el-linux-gnuabi64-real/lib/libslepc_real.so /usr/lib/petscdir/petsc3.14/mips64el-linux-gnuabi64-real/lib/libpetsc_real.so /usr/lib/mips64el-linux-gnuabi64/openmpi/lib/libmpi_cxx.so /usr/lib/mips64el-linux-gnuabi64/openmpi/lib/libmpi.so 
/usr/bin/ld: /tmp/cpp.cpython-39-mips64el-linux-gnuabi64.so.1TtsmU.ltrans32.ltrans.o: .symtab local symbol at index 214 (>= sh_info of 34)
/usr/bin/ld: /tmp/cpp.cpython-39-mips64el-linux-gnuabi64.so.1TtsmU.ltrans32.ltrans.o: error adding symbols: bad value

https://buildd.debian.org/status/fetch.php?pkg=bibletime&arch=mips64el&ver=3.0-2&stamp=1601887167&raw=0

/usr/bin/c++ -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -flto -fno-fat-lto-objects -Wl,-z,relro -Wl,-z,now CMakeFiles/bibletime.dir/bibletime_autogen/mocs_compilation.cpp.o CMakeFiles/bibletime.dir/src/frontend/BookmarkItem.cpp.o CMakeFiles/bibletime.dir/src/frontend/BtMimeData.cpp.o CMakeFiles/bibletime.dir/src/frontend/bibletime.cpp.o CMakeFiles/bibletime.dir/src/frontend/bibletime_init.cpp.o CMakeFiles/bibletime.dir/src/frontend/bibletime_slots.cpp.o CMakeFiles/bibletime.dir/src/frontend/bibletimeapp.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookmarks/bteditbookmarkdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookmarks/cbookmarkindex.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfinstallfinalpage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelflanguagespage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfremovefinalpage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfsourcespage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfsourcesprogresspage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelftaskpage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfwizard.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfwizardpage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btbookshelfworkspage.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/btinstallpagemodel.cpp.o CMakeFiles/bibletime.dir/src/frontend/bookshelfwizard/cswordsetupinstallsourcesdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btaboutdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btaboutmoduledialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btbookshelfdockwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/btbookshelfgroupingmenu.cpp.o CMakeFiles/bibletime.dir/src/frontend/btbookshelfview.cpp.o CMakeFiles/bibletime.dir/src/frontend/btbookshelfwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/btcopybyreferencesdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btmenuview.cpp.o CMakeFiles/bibletime.dir/src/frontend/btmessageinputdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btmodulechooserdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btmoduleindexdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/btopenworkaction.cpp.o CMakeFiles/bibletime.dir/src/frontend/btprinter.cpp.o CMakeFiles/bibletime.dir/src/frontend/bturlhandler.cpp.o CMakeFiles/bibletime.dir/src/frontend/cexportmanager.cpp.o CMakeFiles/bibletime.dir/src/frontend/cinfodisplay.cpp.o CMakeFiles/bibletime.dir/src/frontend/cmdiarea.cpp.o CMakeFiles/bibletime.dir/src/frontend/crossrefrendering.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/btcolorwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/btfindwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/btfontsizewidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/btmodelviewreaddisplay.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/cdisplay.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/creaddisplay.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/modelview/btqmlinterface.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/modelview/btqmlscrollview.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/modelview/btquickwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/display/modelview/bttextfilter.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/btactioncollection.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/btdisplaysettingsbutton.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/btmodulechooserbar.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/btmodulechooserbutton.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/btmodulechoosermenu.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/bttextwindowheader.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/bttextwindowheaderwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/bttoolbarpopupaction.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/cbiblereadwindow.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/cbookreadwindow.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/ccommentaryreadwindow.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/cdisplaywindow.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/clexiconreadwindow.cpp.o CMakeFiles/bibletime.dir/src/frontend/displaywindow/creadwindow.cpp.o CMakeFiles/bibletime.dir/src/frontend/edittextwizard/btedittextpage.cpp.o CMakeFiles/bibletime.dir/src/frontend/edittextwizard/btedittextwizard.cpp.o CMakeFiles/bibletime.dir/src/frontend/edittextwizard/btplainorhtmlpage.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/bthistory.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/cbookkeychooser.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/cbooktreechooser.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/ckeychooser.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/ckeychooserwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/clexiconkeychooser.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/cscrollbutton.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/cscrollerwidgetset.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/versekeychooser/btbiblekeywidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/versekeychooser/btdropdownchooserbutton.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/versekeychooser/btversekeymenu.cpp.o CMakeFiles/bibletime.dir/src/frontend/keychooser/versekeychooser/cbiblekeychooser.cpp.o CMakeFiles/bibletime.dir/src/frontend/main.cpp.o CMakeFiles/bibletime.dir/src/frontend/messagedialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/analysis/csearchanalysisdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/analysis/csearchanalysisitem.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/analysis/csearchanalysislegenditem.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/analysis/csearchanalysisscene.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/analysis/csearchanalysisview.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/btindexdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/btsearchmodulechooserdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/btsearchoptionsarea.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/btsearchresultarea.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/btsearchsyntaxhelpdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/chistorycombobox.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/cmoduleresultview.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/crangechooserdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/csearchdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/searchdialog/csearchresultview.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/btconfigdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/btfontchooserwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/btfontsettings.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/btshortcutsdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/btshortcutseditor.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/btstandardworkstab.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/bttextfilterstab.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/cacceleratorsettings.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/cconfigurationdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/cdisplaysettings.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/clistwidget.cpp.o CMakeFiles/bibletime.dir/src/frontend/settingsdialogs/cswordsettings.cpp.o CMakeFiles/bibletime.dir/src/frontend/tips/bttipdialog.cpp.o CMakeFiles/bibletime.dir/src/frontend/welcome/btwelcomedialog.cpp.o CMakeFiles/bibletime_backend.dir/bibletime_backend_autogen/mocs_compilation.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/btbookshelffiltermodel.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/btbookshelfmodel.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/btbookshelftreemodel.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/categoryitem.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/indexingitem.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/item.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/languageitem.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/bookshelfmodel/moduleitem.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btbookmarksmodel.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btglobal.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btinstallbackend.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btinstallmgr.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btinstallthread.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btsignal.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/btsourcesthread.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/config/btconfig.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/config/btconfigcore.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/cswordmodulesearch.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/drivers/cswordbiblemoduleinfo.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/drivers/cswordbookmoduleinfo.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/drivers/cswordcommentarymoduleinfo.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/drivers/cswordlexiconmoduleinfo.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/drivers/cswordmoduleinfo.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/filters/gbftohtml.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/filters/osistohtml.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/filters/plaintohtml.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/filters/teitohtml.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/filters/thmltohtml.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/keys/cswordkey.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/keys/cswordldkey.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/keys/cswordtreekey.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/keys/cswordversekey.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/managers/btstringmgr.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/managers/cdisplaytemplatemgr.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/managers/clanguagemgr.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/managers/colormanager.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/managers/cswordbackend.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/managers/referencemanager.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/models/btlistmodel.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/models/btmoduletextmodel.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/btinforendering.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/cbookdisplay.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/cchapterdisplay.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/cdisplayrendering.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/centrydisplay.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/chtmlexportrendering.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/cplaintextexportrendering.cpp.o CMakeFiles/bibletime_backend.dir/src/backend/rendering/ctextrendering.cpp.o CMakeFiles/bibletime_backend.dir/src/util/bticons.cpp.o CMakeFiles/bibletime_backend.dir/src/util/btmodules.cpp.o CMakeFiles/bibletime_backend.dir/src/util/cresmgr.cpp.o CMakeFiles/bibletime_backend.dir/src/util/directory.cpp.o CMakeFiles/bibletime_backend.dir/src/util/tool.cpp.o -o bibletime  /usr/lib/mips64el-linux-gnuabi64/libQt5PrintSupport.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5QuickWidgets.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Svg.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Widgets.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Xml.so.5.14.2 -L/usr/lib/mips64el-linux-gnuabi64 /usr/lib/mips64el-linux-gnuabi64/libclucene-core.so /usr/lib/mips64el-linux-gnuabi64/libclucene-shared.so -lsword /usr/lib/mips64el-linux-gnuabi64/libQt5Quick.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5QmlModels.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Qml.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Network.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Gui.so.5.14.2 /usr/lib/mips64el-linux-gnuabi64/libQt5Core.so.5.14.2 
/usr/bin/ld: /tmp/bibletime.kNyaLB.ltrans9.ltrans.o: .symtab local symbol at index 536 (>= sh_info of 65)
/usr/bin/ld: /tmp/bibletime.kNyaLB.ltrans9.ltrans.o: error adding symbols: bad value


Builds with gcc 9, fails with gcc 10.
Fails on 64bit little endian mips, builds on 32bit little endian mips.

It is not clear to me what kind of sources would be useful for you when the failure happens during LTO linking.
Comment 1 Richard Biener 2020-11-11 07:37:49 UTC
I guess it succeeds when you do not enable -g?  Can you check if reverting
63a2bdbfb42628800a6999e98804928855592ce7 or 136256c32db63600168516e562441f73c26a187a helps?  That said, is 10.1.0 OK?
Comment 2 Martin Liška 2020-11-11 07:39:53 UTC
(In reply to Richard Biener from comment #1)
> I guess it succeeds when you do not enable -g?  Can you check if reverting
> 63a2bdbfb42628800a6999e98804928855592ce7 or
> 136256c32db63600168516e562441f73c26a187a helps?  That said, is 10.1.0 OK?

I bet 136256c32db63600168516e562441f73c26a187a should fix that.
Comment 3 Adrian Bunk 2020-11-11 14:14:26 UTC
(In reply to Richard Biener from comment #1)
> I guess it succeeds when you do not enable -g?

Still fails with -g0

(In reply to Richard Biener from comment #1)
> Can you check if reverting
> 63a2bdbfb42628800a6999e98804928855592ce7 or
> 136256c32db63600168516e562441f73c26a187a helps?  That said, is 10.1.0 OK?

(In reply to Martin Liška from comment #2)
> I bet 136256c32db63600168516e562441f73c26a187a should fix that.

Sorry for omitting more exact version information in the bug report.

Known-broken are all Debian gcc-10 packages since gcc 10 became default in Debian unstable, upstream this is the gcc-10 branch from 20200808 to 20201029.

This implies that the two mentioned commits did not break or fix it.

Is there any debug information I could gather that might be useful for you?
Comment 4 Richard Biener 2020-11-11 15:04:49 UTC
Hmm, the final linker input, namely /tmp/bibletime.kNyaLB.ltrans9.ltrans.o
would be a start.  Adding -save-temps should eventually retain it (but likely
somewhere else with a different name).

You can also try to 'reduce' the testcase.  Since you are linking a shared
object you can try to strip as many linker inputs as possible and then
reduce the source files.  creduce or multi-delta or cvise might help you
here.  Eventually Martin can help but I don't think the compile-farm has
a mips64 machine.
Comment 5 Adrian Bunk 2020-11-12 18:52:46 UTC
(In reply to Richard Biener from comment #4)
> You can also try to 'reduce' the testcase.  Since you are linking a shared
> object you can try to strip as many linker inputs as possible and then
> reduce the source files.

Bisecting does not work when both halves are working, but I now found some clues:

$ g++ -flto -shared CMakeFiles/cpp.dir/src/dolfin.cpp.o CMakeFiles/cpp.dir/src/parameter.cpp.o CMakeFiles/cpp.dir/src/adaptivity.cpp.o CMakeFiles/cpp.dir/src/ale.cpp.o CMakeFiles/cpp.dir/src/common.cpp.o CMakeFiles/cpp.dir/src/fem.cpp.o CMakeFiles/cpp.dir/src/function.cpp.o CMakeFiles/cpp.dir/src/generation.cpp.o CMakeFiles/cpp.dir/src/geometry.cpp.o CMakeFiles/cpp.dir/src/graph.cpp.o CMakeFiles/cpp.dir/src/log.cpp.o CMakeFiles/cpp.dir/src/math.cpp.o CMakeFiles/cpp.dir/src/mesh.cpp.o CMakeFiles/cpp.dir/src/multistage.cpp.o CMakeFiles/cpp.dir/src/ts.cpp.o CMakeFiles/cpp.dir/src/io.cpp.o CMakeFiles/cpp.dir/src/la.cpp.o CMakeFiles/cpp.dir/src/nls.cpp.o CMakeFiles/cpp.dir/src/refinement.cpp.o CMakeFiles/cpp.dir/src/MPICommWrapper.cpp.o
/usr/bin/ld: /tmp/ccofV1SZ.ltrans32.ltrans.o: .symtab local symbol at index 214 (>= sh_info of 34)
/usr/bin/ld: /tmp/ccofV1SZ.ltrans32.ltrans.o: error adding symbols: bad value
collect2: error: ld returned 1 exit status
$  g++ -flto -shared dolfin.ii parameter.ii adaptivity.ii ale.ii common.ii fem.ii function.ii generation.ii geometry.ii graph.ii log.ii math.ii mesh.ii multistage.ii ts.ii io.ii la.ii nls.ii refinement.ii MPICommWrapper.ii
/tmp/ccraiNyo.ltrans9.ltrans.o: in function `std::__exception_ptr::exception_ptr::operator=(std::__exception_ptr::exception_ptr&&)':
<artificial>:(.text+0x290): relocation truncated to fit: R_MIPS_CALL16 against `std::__exception_ptr::exception_ptr::~exception_ptr()@@CXXABI_1.3.3'
/tmp/ccraiNyo.ltrans9.ltrans.o: in function `std::__cxx11::to_string(int)':
<artificial>:(.text+0x414): relocation truncated to fit: R_MIPS_CALL16 against `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(unsigned long, char, std::allocator<char> const&)@@GLIBCXX_3.4.21'
<artificial>:(.text+0x42c): relocation truncated to fit: R_MIPS_CALL16 against `std::allocator<char>::~allocator()@@GLIBCXX_3.4'
<artificial>:(.text+0x498): relocation truncated to fit: R_MIPS_CALL16 against `std::allocator<char>::~allocator()@@GLIBCXX_3.4'
<artificial>:(.text+0x4b0): relocation truncated to fit: R_MIPS_CALL16 against `_Unwind_Resume@@GCC_3.0'
<artificial>:(.text+0x4e0): relocation truncated to fit: R_MIPS_CALL16 against `_Unwind_Resume@@GCC_3.0'
/tmp/ccraiNyo.ltrans9.ltrans.o: in function `std::__cxx11::to_string(unsigned long)':
<artificial>:(.text+0x584): relocation truncated to fit: R_MIPS_CALL16 against `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(unsigned long, char, std::allocator<char> const&)@@GLIBCXX_3.4.21'
<artificial>:(.text+0x598): relocation truncated to fit: R_MIPS_CALL16 against `std::allocator<char>::~allocator()@@GLIBCXX_3.4'
<artificial>:(.text+0x5c8): relocation truncated to fit: R_MIPS_CALL16 against `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const@@GLIBCXX_3.4.21'
<artificial>:(.text+0x610): relocation truncated to fit: R_MIPS_CALL16 against `std::allocator<char>::~allocator()@@GLIBCXX_3.4'
<artificial>:(.text+0x628): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
$ g++ -flto -shared dolfin.ii parameter.ii adaptivity.ii ale.ii common.ii fem.ii function.ii generation.ii geometry.ii graph.ii log.ii math.ii mesh.ii multistage.ii ts.ii io.ii la.ii nls.ii refinement.ii MPICommWrapper.ii -mxgot
$ g++ -flto -shared CMakeFiles/cpp.dir/src/dolfin.cpp.o CMakeFiles/cpp.dir/src/parameter.cpp.o CMakeFiles/cpp.dir/src/adaptivity.cpp.o CMakeFiles/cpp.dir/src/ale.cpp.o CMakeFiles/cpp.dir/src/common.cpp.o CMakeFiles/cpp.dir/src/fem.cpp.o CMakeFiles/cpp.dir/src/function.cpp.o CMakeFiles/cpp.dir/src/generation.cpp.o CMakeFiles/cpp.dir/src/geometry.cpp.o CMakeFiles/cpp.dir/src/graph.cpp.o CMakeFiles/cpp.dir/src/log.cpp.o CMakeFiles/cpp.dir/src/math.cpp.o CMakeFiles/cpp.dir/src/mesh.cpp.o CMakeFiles/cpp.dir/src/multistage.cpp.o CMakeFiles/cpp.dir/src/ts.cpp.o CMakeFiles/cpp.dir/src/io.cpp.o CMakeFiles/cpp.dir/src/la.cpp.o CMakeFiles/cpp.dir/src/nls.cpp.o CMakeFiles/cpp.dir/src/refinement.cpp.o CMakeFiles/cpp.dir/src/MPICommWrapper.cpp.o -flto-partition=none
$ 

Adding -mxgot to compiler and linker flags of a normal LTO build does not work, but -flto-partition=none during linking is a workaround.
Comment 6 Richard Biener 2020-11-13 08:35:12 UTC
I see.  Still GCC or GAS produces a bogus object file (the original linker error).  It might be the new problem is an entirely different one?  It looks
more and more like a target problem to me.

CCing the mips maintainer.
Comment 7 Adrian Bunk 2020-11-13 19:12:53 UTC
(In reply to Richard Biener from comment #6)
> I see.  Still GCC or GAS produces a bogus object file (the original linker
> error).  It might be the new problem is an entirely different one?  It looks
> more and more like a target problem to me.

My guess would be that the situations where -mxgot is required on 64bit MIPS are not (no longer?) handled properly with LTO.

Note that when compiling from precompiled sources the linker also exits with an error, the main difference in that case is that the correct "relocation truncated to fit" error message is not output in the LTO case.

More worrisome is that adding -mxgot to compiler and linker flags did not fix it in the LTO case.
Comment 8 rguenther@suse.de 2020-11-16 12:30:15 UTC
On Fri, 13 Nov 2020, bunk at stusta dot de wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787
> 
> --- Comment #7 from Adrian Bunk <bunk at stusta dot de> ---
> (In reply to Richard Biener from comment #6)
> > I see.  Still GCC or GAS produces a bogus object file (the original linker
> > error).  It might be the new problem is an entirely different one?  It looks
> > more and more like a target problem to me.
> 
> My guess would be that the situations where -mxgot is required on 64bit MIPS
> are not (no longer?) handled properly with LTO.
> 
> Note that when compiling from precompiled sources the linker also exits with an
> error, the main difference in that case is that the correct "relocation
> truncated to fit" error message is not output in the LTO case.
> 
> More worrisome is that adding -mxgot to compiler and linker flags did not fix
> it in the LTO case.

I guess it is because -mxgot is supposed to be handled by the assembler?
I see

%{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \

in ASM_SPEC.  I guess this doesn't make it to COLLECT_AS_OPTIONS
and eventually makes it dropped from COLLECT_GCC_OPTIONS as well.

Can you attach the full output of compiling & linking with -v added?

Can you try using -mxgot -Wa,-xgot or -mxgot -Xassembler -xgot at
compile time?
Comment 9 Xi Ruoyao 2021-01-16 13:15:20 UTC
(In reply to rguenther@suse.de from comment #8)

> I guess it is because -mxgot is supposed to be handled by the assembler?
> I see
> 
> %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
> 
> in ASM_SPEC.  I guess this doesn't make it to COLLECT_AS_OPTIONS
> and eventually makes it dropped from COLLECT_GCC_OPTIONS as well.

I don't think so.

I can reproduce this issue compiling spidermonkey (js interpreter) from firefox-78 ESR.  I'm using "-pipe" so I can easily find the parameters passed to "as", using "ps -aux".  "-xgot" is passed correctly.

> Can you attach the full output of compiling & linking with -v added?
>
> Can you try using -mxgot -Wa,-xgot or -mxgot -Xassembler -xgot at
> compile time?

I'm trying, though my gut feeling is that it won't work.
Comment 10 Xi Ruoyao 2021-01-16 13:31:39 UTC
(In reply to Xi Ruoyao from comment #9)
> (In reply to rguenther@suse.de from comment #8)
> > Can you try using -mxgot -Wa,-xgot or -mxgot -Xassembler -xgot at
> > compile time?
> 
> I'm trying, though my gut feeling is that it won't work.

There is no luck. "-mxgot -Wa,-xgot" gives the same error.
Comment 11 Xi Ruoyao 2021-01-16 13:55:18 UTC
In my case the error message is:

/usr/bin/ld: js.ltrans2.ltrans.o: .symtab local symbol at index 1411 (>= sh_info of 404) 
/usr/bin/ld: js.ltrans2.ltrans.o: error adding symbols: bad value

I've uploaded the "guilty" files, js.ltrans2.* to my server, at

https://bf.mengyan1223.wang/assets/gcc-97787/

so someone can analysis it.
Comment 12 Xi Ruoyao 2021-01-16 14:10:03 UTC
"readelf -s js.ltrans2.ltrans.o" gives a strange unnamed UND symbol:

  1411: 0000000000000000     0 SECTION LOCAL  DEFAULT  UND 

I'm not sure what's happening...
Comment 13 Richard Biener 2021-01-18 08:15:33 UTC
(In reply to Xi Ruoyao from comment #9)
> (In reply to rguenther@suse.de from comment #8)
> 
> > I guess it is because -mxgot is supposed to be handled by the assembler?
> > I see
> > 
> > %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
> > 
> > in ASM_SPEC.  I guess this doesn't make it to COLLECT_AS_OPTIONS
> > and eventually makes it dropped from COLLECT_GCC_OPTIONS as well.
> 
> I don't think so.
> 
> I can reproduce this issue compiling spidermonkey (js interpreter) from
> firefox-78 ESR.  I'm using "-pipe" so I can easily find the parameters
> passed to "as", using "ps -aux".  "-xgot" is passed correctly.
> 
> > Can you attach the full output of compiling & linking with -v added?

^^^ (output aka output on the console)

I think the issue should be visible from a simple hello world compiled
with LTO and -mxgot (aka not using -xgot in the approproate places in the
end, not failing the link in the end).
Comment 14 Xi Ruoyao 2021-01-22 12:04:05 UTC
(In reply to Richard Biener from comment #13)
> (In reply to Xi Ruoyao from comment #9)
> > (In reply to rguenther@suse.de from comment #8)
> > 
> > > I guess it is because -mxgot is supposed to be handled by the assembler?
> > > I see
> > > 
> > > %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
> > > 
> > > in ASM_SPEC.  I guess this doesn't make it to COLLECT_AS_OPTIONS
> > > and eventually makes it dropped from COLLECT_GCC_OPTIONS as well.
> > 
> > I don't think so.
> > 
> > I can reproduce this issue compiling spidermonkey (js interpreter) from
> > firefox-78 ESR.  I'm using "-pipe" so I can easily find the parameters
> > passed to "as", using "ps -aux".  "-xgot" is passed correctly.
> > 
> > > Can you attach the full output of compiling & linking with -v added?
> 
> ^^^ (output aka output on the console)

Reproduced again, building libsass.

The output without -mxgot: https://bf.mengyan1223.wang/assets/gcc-97787/libsass_so_lto_output.tar.xz

The output with -mxgot: https://bf.mengyan1223.wang/assets/gcc-97787/libsass_so_lto_output_mxgot.tar.xz

Full console output with --verbose is included in the tarballs, named console.log.

> I think the issue should be visible from a simple hello world compiled
> with LTO and -mxgot (aka not using -xgot in the approproate places in the
> end, not failing the link in the end).

Actually I don't think it's a xgot issue... With or without -mxgot I got exactly same error message.
Comment 15 Richard Biener 2021-01-22 13:19:19 UTC
So I see that

   242: 0000000000000000     0 SECTION LOCAL  DEFAULT  UND 

and that's indeed broken (UND SECTION?)  but ld complains that the SECTION
type is after the last section entry.  So next up would be to look at the
assembly file the compiler generates for libsass.so.1.0.0.ltrans16.ltrans.o.

The console output shows how it's generated:

 as -v -EL -mips64r2 -mips64r2 -mmsa -mloongson-ext -mloongson-ext -mloongson-ext2 -mloongson-ext2 -O2 -mabi=64 -mabi=64 -march=gs464e -march=gs464e -march=gs464e -mtune=gs464e -mtune=gs464e -mtune=gs464e -KPIC -o libsass.so.1.0.0.ltrans16.ltrans.o libsass.so.1.0.0.ltrans16.s

and the "last" section I see in there is

        .section        .note.GNU-stack,"",@progbits

and I can confirm that GNU as (2.35.1) produces an object with the strange
section (using a cross binutils).  I think that no valid assembly file
should produce that so may I suggest to file a bug at sourceware for an
assembler issue? (just use the libsass.so.1.0.0.ltrans16.s file as testcase)

Maybe there's more mips people around than here.
Comment 16 Xi Ruoyao 2021-01-22 16:53:59 UTC
(In reply to Richard Biener from comment #15)
> So I see that
> 
>    242: 0000000000000000     0 SECTION LOCAL  DEFAULT  UND 
> 
> and that's indeed broken (UND SECTION?)  but ld complains that the SECTION
> type is after the last section entry.  So next up would be to look at the
> assembly file the compiler generates for libsass.so.1.0.0.ltrans16.ltrans.o.
> 
> The console output shows how it's generated:
> 
>  as -v -EL -mips64r2 -mips64r2 -mmsa -mloongson-ext -mloongson-ext
> -mloongson-ext2 -mloongson-ext2 -O2 -mabi=64 -mabi=64 -march=gs464e
> -march=gs464e -march=gs464e -mtune=gs464e -mtune=gs464e -mtune=gs464e -KPIC
> -o libsass.so.1.0.0.ltrans16.ltrans.o libsass.so.1.0.0.ltrans16.s
> 
> and the "last" section I see in there is
> 
>         .section        .note.GNU-stack,"",@progbits
> 
> and I can confirm that GNU as (2.35.1) produces an object with the strange
> section (using a cross binutils).  I think that no valid assembly file
> should produce that so may I suggest to file a bug at sourceware for an
> assembler issue? (just use the libsass.so.1.0.0.ltrans16.s file as testcase)
> 
> Maybe there's more mips people around than here.

I managed to make a smallest testcase (by removing lines in ltrans16.s) to generate such a buggy section:

	.text
foo:
	.reloc	1f,R_MIPS_JALR,.LTHUNK5.lto_priv.0
1:	nop

I'm not a toolchain expert.  If you believe it looks like a gas bug, let's report it to gas.
Comment 17 Xi Ruoyao 2021-01-23 12:17:59 UTC
Reported as https://sourceware.org/bugzilla/show_bug.cgi?id=27228
Comment 18 Xi Ruoyao 2021-01-23 13:04:29 UTC
Oh no.  Now I think it's GCC side.

According to gas doc

https://sourceware.org/binutils/docs/as/Symbol-Names.html#Symbol-Names

.LTHUNK5.lto_priv.0 should be a local label.  But in our LTO output, this label is defined in libsass.so.1.0.0.ltrans1.s and used in other ltrans files.
Comment 19 Xi Ruoyao 2021-01-24 12:47:43 UTC
gas has added a workaround.  I'll test it tomorrow.
Comment 20 Richard Biener 2021-01-25 08:19:38 UTC
Indeed already the name, .LTHUNK5.lto_priv.0, hints at that this should be a local symbol.  Not sure why we end up with a .reloc then.

        ld      $25,%got_disp(.LTHUNK5.lto_priv.0)($28)
.LEHB26 = .
        .reloc  1f,R_MIPS_JALR,.LTHUNK5.lto_priv.0
1:      jalr    $25

this seems to be in _ZN4Sass6Parser16parse_parametersEv

Maybe it's possible to reduce the testcase by bisecting the object files
necessary to produce the bogus LTRANS assembly?  From that one can start
reducing the source of the necessary object files.

Another interesting bit would be to see the IPA dumps of the broken LTRANS
unit.  If you add -fdump-ipa-all-details to the link command you should get
dump files alongside the ltrans temp files.
Comment 21 Xi Ruoyao 2021-01-25 10:16:05 UTC
(In reply to Richard Biener from comment #20)
> Indeed already the name, .LTHUNK5.lto_priv.0, hints at that this should be a
> local symbol.  Not sure why we end up with a .reloc then.
> 
>         ld      $25,%got_disp(.LTHUNK5.lto_priv.0)($28)
> .LEHB26 = .
>         .reloc  1f,R_MIPS_JALR,.LTHUNK5.lto_priv.0
> 1:      jalr    $25
> 
> this seems to be in _ZN4Sass6Parser16parse_parametersEv
> 
> Maybe it's possible to reduce the testcase by bisecting the object files
> necessary to produce the bogus LTRANS assembly?  From that one can start
> reducing the source of the necessary object files.
> 
> Another interesting bit would be to see the IPA dumps of the broken LTRANS
> unit.  If you add -fdump-ipa-all-details to the link command you should get
> dump files alongside the ltrans temp files.

I can confirm that the workaround in gas (released in binutils-2.36) "fixes" the problem.

Some function aliases named ".LTHUNK%d" are created in C++ FE (cp/method.c, L232).  With LTO those are cloned as ".LTHUNK%d.lto_priv.%d".

Functions aliases should not be named ".xxx" IMO.  Perhaps names like __gcc_lthunk.%d is better.
Comment 22 Richard Biener 2021-01-25 10:30:00 UTC
There is target specific sanitizing of symbol names - if the name is really the issue then it should be _much_ more prevalent since all IPA cloning uses
dots as well.  clone_function_name produces them and ASM_FORMAT_PRIVATE_NAME
is the "sanitizer" that's supposed to mangle it to correct form.  But as the
name suggests the definition of a local private symbol isn't supposed to go
away without all of its uses so the real issue must be elsewhere in optimization.
(thus asking for IPA dumps, specifically the .000i.cgraph dump which should
mention when the compiler thinks the .LTHUNK5.lto_priv.0 goes away)
Comment 23 Andrew Pinski 2021-01-25 10:49:48 UTC
(In reply to Richard Biener from comment #20)
> Indeed already the name, .LTHUNK5.lto_priv.0, hints at that this should be a
> local symbol.  Not sure why we end up with a .reloc then.
> 
>         ld      $25,%got_disp(.LTHUNK5.lto_priv.0)($28)
> .LEHB26 = .
>         .reloc  1f,R_MIPS_JALR,.LTHUNK5.lto_priv.0
> 1:      jalr    $25
> 
> this seems to be in _ZN4Sass6Parser16parse_parametersEv

So 64bit MIPS n64 ABI with -mxgot does all function calls via loading an address from the GOT, the .reloc there is to say to the linker to see if it can relax it to be a direct jump (with link) rather than the indirect jump.

Looking into the cp/method.c code, I see we are creating an alias called .LTHUNK5 for a function which seems to be fine.  So either we are not outputing the correct name or the way local aliases are not being handled correctly when splitting up the LTO partitions; -flto-partition=none is a hint there.
Comment 24 Xi Ruoyao 2021-01-25 11:05:48 UTC
(In reply to Richard Biener from comment #22)
> There is target specific sanitizing of symbol names - if the name is really
> the issue then it should be _much_ more prevalent since all IPA cloning uses
> dots as well.  clone_function_name produces them and ASM_FORMAT_PRIVATE_NAME
> is the "sanitizer" that's supposed to mangle it to correct form.  But as the
> name suggests the definition of a local private symbol isn't supposed to go
> away without all of its uses so the real issue must be elsewhere in
> optimization.
> (thus asking for IPA dumps, specifically the .000i.cgraph dump which should
> mention when the compiler thinks the .LTHUNK5.lto_priv.0 goes away)

IPA dumps (along with .ltrans* files) are uploaded: https://bf.mengyan1223.wang/assets/gcc-97787/libsass_lto_ipa_dump.tar.xz
Comment 25 Richard Biener 2021-01-25 11:22:39 UTC
OK, so it's read as

*.LTHUNK5.lto_priv.0/2880 (*.LTHUNK5) @0xfff1163840
  Type: function definition analyzed alias
  Visibility: in_other_partition used_from_other_partition prevailing_def_ironly external public visibility_specified visibility:hidden artificial
  References: _ZN4Sass10Parameters20adjust_after_pushingENS_10SharedImplINS_9ParameterEEE/2879 (alias)
  Referring:
  Read from file: libsass.so.1.0.0.ltrans16.o
  Unit id: 3
  Function flags:
  Called by: _ZThn64_N4Sass10Parameters20adjust_after_pushingENS_10SharedImplINS_9ParameterEEE/349153 (can throw external) _ZThn64_N4Sass10Parameters20adjust_after_pushingENS_10SharedImplINS_9ParameterEEE/2881 (can throw external)
  Calls:

and thus indeed "external" (in_other_partition).  Defined in ltrans1.s as

        .globl  .LTHUNK5.lto_priv.0
        .hidden .LTHUNK5.lto_priv.0
        .LTHUNK5.lto_priv.0 = _ZN4Sass10Parameters20adjust_after_pushingENS_10SharedImplINS_9ParameterEEE

which I think means that possibly the process of bringing a symbol local
needs to mangle the assembler name before using it more thoroughly or the
mips target in particular needs to introduce the extern symbol to the
assembler to not confuse it with a local label.  I think the latter is
more likely - Honza should know if other targets (like AIX ...) are
affected similarly and what we have to do here.

Honza?
Comment 26 Richard Biener 2021-04-08 12:02:14 UTC
GCC 10.3 is being released, retargeting bugs to GCC 10.4.
Comment 27 Richard Biener 2021-04-09 07:57:05 UTC
Honza, please have a look at this PR.
Comment 28 Richard Biener 2022-03-22 10:39:23 UTC
Honza?
Comment 29 Xi Ruoyao 2022-03-22 11:19:01 UTC
GNU ld has added a workaround for this.  But I'm not sure what will happen using other linkers (gold or lld).
Comment 30 Richard Biener 2022-03-22 11:33:03 UTC
Maybe it's fixed on trunk with r12-7325-g2f59f067610f22
Comment 31 Jakub Jelinek 2022-03-22 11:43:31 UTC
Does any *.o file being LTO linked together have > 64K sections?
Comment 32 Jakub Jelinek 2022-06-28 10:42:24 UTC
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Comment 33 Richard Biener 2023-07-07 10:38:25 UTC
GCC 10 branch is being closed.