[Bug driver/81358] libatomic not automatically linked with C11 code

2024-04-03 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358

--- Comment #15 from Adrian Bunk  ---
(In reply to Tobias Burnus from comment #11)
> RFC draft patch – also to solve an offload problem with atomic and nvptx
> libgomp:
> https://gcc.gnu.org/pipermail/gcc-patches/2020-October/556297.html
> See reply for what still needs to be done (esp. related to building
> libraries + testsuite).

Was there any reason why this was stalled?

More and more packages in Debian need manual addition of libatomic on some
32bit vintage architectures (armv5/m68k/mips/powerpc/sh4) due to this, which is
a pain.

Is the only issue that noone has addressed the comments in the reply on the
mailing list, or have there also been other problems?

[Bug target/104713] gcc does not reject -march=i686 -fcf-protection

2023-03-20 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104713

--- Comment #6 from Adrian Bunk  ---
(In reply to James Addison from comment #5)
> Could the findings indicate that there are two bugs here?
> 
>   - The Geode LX target capable of supporting fcf-protection but GCC-11
> currently rejects that architecture and flag combination

The problem is the opposite.

[Bug target/104713] gcc does not reject -march=i686 -fcf-protection

2022-02-28 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104713

--- Comment #4 from Adrian Bunk  ---
(In reply to Jakub Jelinek from comment #3)
> Just build for those as -march=i586.

There is no "for those" in Debian.
There is one build of all packages for one i386 Debian release architecture.

Building the Debian i386 architecture with -march=i586 would also remove CMOV
support.

> i686 is what is used as the supported lowest
> common denominator of 32-bit code.

This is not true.

The lowest common denominator of 32-bit x86 code on Linux is -march=i486, since
the 486 is the lowest supported CPU in the kernel.

Distributions usually use various baselines higher than 486 for their 32-bit
x86 ports.
E.g. for distributions dropping support for actual 32-bit hardware (keeping
only multiarch/multilib support), using -march=x86-64 (or whatever higher they
are using for their 64bit x86) might make more sense since it also brings
MMX/SSE/SSE2 which are not in -march=i686 (this also allows using SSE instead
of the x87 FPU with its excess precision oddity).

> preventing -fcf-protection with
> -march=i686 would be a really bad idea, that would basically prevent all of
> CET protection for 32-bit code,

The toolchain emitting instructions not supported by the selected target is
also a really bad idea.

gcc rejecting -fcf-protection for < 686 indicates that this option was not
intended to enable emitting instructions not already supported by the -march
setting.

The proper solution might be a -mmultibyte-nops option?

[Bug target/104713] gcc does not reject -march=i686 -fcf-protection

2022-02-28 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104713

--- Comment #2 from Adrian Bunk  ---
(In reply to Andrew Pinski from comment #1)
> Is OLPC really still around? I thought it died when Google came out with
> their chrome books.

Sorry for being unclear, this is the historical reason why the binutils/gcc
definition of i686 does not include multi-byte NOPs.

While all 32bit x86 hardware is pretty dated in the year 2022, there is still a
surprisingly large number of users of 32bit x86 including like in the case of
this Debian bug on a (likely non-OLPC) Geode.

The Debian i386 port has the toolchain configured for i686, and it is therefore
a problem that due to this gcc bug an autoconf test for -fcf-protection
succeeds.

[Bug target/104713] New: gcc does not reject -march=i686 -fcf-protection

2022-02-28 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104713

Bug ID: 104713
   Summary: gcc does not reject -march=i686 -fcf-protection
   Product: gcc
   Version: 11.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bunk at stusta dot de
  Target Milestone: ---

To support the Geode in OLPC, the toolchain definition of i686 does include
CMOV but it does not include multi-byte NOPs.

https://bugs.debian.org/1004894 is due to autodetection for -fcf-protection
that incorrectly succeeds with -march=i686.

The bug is likely in
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/i386/i386-options.cc;h=805539364108eee07f5bda527acd6f39f3f7bf95;hb=HEAD#l2929

A similar problem in a different place was bug 84148.

Testcase:
$ touch test.c
$ gcc -m32 -march=i586 -fcf-protection -c test.c
cc1: error: ‘-fcf-protection’ is not compatible with this target
$ gcc -m32 -march=i686 -fcf-protection -c test.c
$

[Bug target/102602] [10/11/12 Regression] 32bit mips: Error: branch out of range

2021-10-05 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102602

--- Comment #1 from Adrian Bunk  ---
Created attachment 51553
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51553=edit
Generated assembler

[Bug target/102602] New: [10/11/12 Regression] 32bit mips: Error: branch out of range

2021-10-05 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102602

Bug ID: 102602
   Summary: [10/11/12 Regression] 32bit mips: Error: branch out of
range
   Product: gcc
   Version: 10.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bunk at stusta dot de
  Target Milestone: ---

Created attachment 51552
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51552=edit
Preprocessed sources

With a command like
/usr/lib/gcc/mipsel-linux-gnu/10/cc1plus -fpreprocessed Options.ii -mel -quiet
-dumpbase Options.ii -march=mips32r2 -auxbase Options -O2 -version -o
/tmp/cccmq2Yu.s
the attached file from a failed build of https://tracker.debian.org/pkg/kstars
generates code the assembler rejects.

$ g++-10 -c -O2 Options.ii 
/tmp/ccecXwRM.s: Assembler messages:
/tmp/ccecXwRM.s:4908: Error: branch out of range
/tmp/ccecXwRM.s:54845: Error: branch out of range
/tmp/ccecXwRM.s:54868: Error: branch out of range
$

For working and known broken gcc versions, Debian revisions and date they were
taken from the upstream branch are:

Working:
10.2.1-6 (git 20210110 from the gcc-10 branch)

Broken:
10.3.0-11 (git 20210918 from the gcc-10 branch)
11.2.0-8 (git 20210924 from the gcc-11 branch)
20210909-1 (git 20210918 from master)

[Bug target/97787] [10/11 regression] 64bit mips lto: .symtab local symbol at index x (>= sh_info of y)

2020-11-13 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787

--- Comment #7 from Adrian Bunk  ---
(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.

[Bug lto/97787] [10/11 regression] 64bit mips lto: .symtab local symbol at index x (>= sh_info of y)

2020-11-12 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787

--- Comment #5 from Adrian Bunk  ---
(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&&)':
:(.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)':
:(.text+0x414): relocation truncated to fit: R_MIPS_CALL16 against
`std::__cxx11::basic_string, std::allocator
>::basic_string(unsigned long, char, std::allocator
const&)@@GLIBCXX_3.4.21'
:(.text+0x42c): relocation truncated to fit: R_MIPS_CALL16 against
`std::allocator::~allocator()@@GLIBCXX_3.4'
:(.text+0x498): relocation truncated to fit: R_MIPS_CALL16 against
`std::allocator::~allocator()@@GLIBCXX_3.4'
:(.text+0x4b0): relocation truncated to fit: R_MIPS_CALL16 against
`_Unwind_Resume@@GCC_3.0'
:(.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)':
:(.text+0x584): relocation truncated to fit: R_MIPS_CALL16 against
`std::__cxx11::basic_string, std::allocator
>::basic_string(unsigned long, char, std::allocator
const&)@@GLIBCXX_3.4.21'
:(.text+0x598): relocation truncated to fit: R_MIPS_CALL16 against
`std::allocator::~allocator()@@GLIBCXX_3.4'
:(.text+0x5c8): relocation truncated to fit: R_MIPS_CALL16 against
`std::__cxx11::basic_string, std::allocator
>::size() const@@GLIBCXX_3.4.21'
:(.text+0x610): relocation truncated to fit: R_MIPS_CALL16 against
`std::allocator::~allocator()@@GLIBCXX_3.4'
:(.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.

[Bug lto/97787] [10/11 regression] 64bit mips lto: .symtab local symbol at index x (>= sh_info of y)

2020-11-11 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787

Adrian Bunk  changed:

   What|Removed |Added

 CC||bunk at stusta dot de

--- Comment #3 from Adrian Bunk  ---
(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?

[Bug lto/97787] New: [10/11 regression] 64bit mips lto: .symtab local symbol at index x (>= sh_info of y)

2020-11-10 Thread bunk at stusta dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787

Bug ID: 97787
   Summary: [10/11 regression] 64bit mips lto: .symtab local
symbol at index x (>= sh_info of y)
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bunk at stusta dot de
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

https://buildd.debian.org/status/fetch.php?pkg=dolfin=mips64el=2019.2.0~git20200629.946dbd3-4=1604936169=0

/usr/bin/c++ -fPIC -g -O2 -fdebug-prefix-map=/<>=.
-fstack-protector-strong -Wformat -Werror=format-security -isystem
/<>/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,"/<>/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"
"/<>/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=mips64el=3.0-2=1601887167=0

/usr/bin/c++ -g -O2 -fdebug-prefix-map=/<>=.
-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