public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load'
@ 2022-08-08  8:09 vries at gcc dot gnu.org
  2022-08-08  8:40 ` [Bug build/29455] " vries at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-08  8:09 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29455
           Summary: [gdb/build, clang-13] undefined reference to
                    `__atomic_load'
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I tried to build gdb with clang-13:
...
$ clang-13 -v 
clang version 13.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/10
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/11
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/12
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/4.8
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/6
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/7
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/8
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/9
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
...
and ran into:
...
/usr/bin/ld: unittests/packed-selftests.o: in function
`std::atomic<packed<unsigned int, 2ul> >::load(std::memory_order) const':
/usr/bin/../lib64/gcc/x86_64-suse-linux/12/../../../../include/c++/12/atomic:285:
undefined reference to `__atomic_load'
/usr/bin/ld: unittests/packed-selftests.o: in function
`std::atomic<packed<unsigned int, 2ul> >::store(packed<unsigned int, 2ul>,
std::memory_order)':
/usr/bin/../lib64/gcc/x86_64-suse-linux/12/../../../../include/c++/12/atomic:271:
undefined reference to `__atomic_store'
clang-13.0: error: linker command failed with exit code 1 (use -v to see
invocation)
make[1]: *** [gdb] Error 1
make[1]: Target `all' not remade because of errors.
make[1]: Leaving directory `/home/vries/gdb_versions/devel/build/gdb'
make: *** [all-gdb] Error 2
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
@ 2022-08-08  8:40 ` vries at gcc dot gnu.org
  2022-08-08  9:01 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-08  8:40 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Clang seems to use gcc-12, so I've tried building with gcc-12, and that went
fine.

FWIW, I've also tried playing around a bit with --gcc-toolchain to make clang
use a different gcc version, but didn't manage to get a hello world executable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
  2022-08-08  8:40 ` [Bug build/29455] " vries at gcc dot gnu.org
@ 2022-08-08  9:01 ` vries at gcc dot gnu.org
  2022-08-08 13:43 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-08  9:01 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
I run into the same problem with clang-8.0.1 (which also uses gcc-12).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
  2022-08-08  8:40 ` [Bug build/29455] " vries at gcc dot gnu.org
  2022-08-08  9:01 ` vries at gcc dot gnu.org
@ 2022-08-08 13:43 ` tromey at sourceware dot org
  2022-08-08 15:09 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2022-08-08 13:43 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Searching suggests that perhaps with clang you need an explicit -latomic.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-08-08 13:43 ` tromey at sourceware dot org
@ 2022-08-08 15:09 ` vries at gcc dot gnu.org
  2022-08-09  8:33 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-08 15:09 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #3)
> Searching suggests that perhaps with clang you need an explicit -latomic.

I tried:
...
"CC=clang-$n" "CXX=clang++-$n" "LIBS=-latomic"
...
as configure arguments, but ran into the same trouble.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-08-08 15:09 ` vries at gcc dot gnu.org
@ 2022-08-09  8:33 ` vries at gcc dot gnu.org
  2022-08-09  8:46 ` vries at gcc dot gnu.org
  2022-08-12  3:15 ` lienze at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-09  8:33 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
I also tried building on openSUSE tumbleweed, with clang 14.0.6, where clang
also selects gcc-12, but in this case it's the system gcc.

Same problem occurs.

In addition, we see "ld: DWARF error: invalid or unhandled FORM value: 0x23",
which is DW_FORM_rnglistx.

This is with ld v2.38.  On trunk, this is something that should be (at least
partially) addressed by commit b44cfc5de13 ("Stop the linker from complaining
about unrecognised DW_FORM-rnglistx and DW_FORM_loclistx format attributes.")

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-08-09  8:33 ` vries at gcc dot gnu.org
@ 2022-08-09  8:46 ` vries at gcc dot gnu.org
  2022-08-12  3:15 ` lienze at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2022-08-09  8:46 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #5)
> I also tried building on openSUSE tumbleweed, with clang 14.0.6, where clang
> also selects gcc-12, but in this case it's the system gcc.
> 
> Same problem occurs.
> 

I managed to complete a build using:
...
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 2598b81d205..ebd7d27dc11 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -654,7 +654,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD)
$(ZLIB
) \
        $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
        $(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \
        $(LIBMPFR) $(LIBGMP) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
-       $(DEBUGINFOD_LIBS) $(LIBBABELTRACE_LIB)
+       $(DEBUGINFOD_LIBS) $(LIBBABELTRACE_LIB) -latomic
 CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \
        $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
        $(LIBSUPPORT)
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug build/29455] [gdb/build, clang-13] undefined reference to `__atomic_load'
  2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-08-09  8:46 ` vries at gcc dot gnu.org
@ 2022-08-12  3:15 ` lienze at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: lienze at sourceware dot org @ 2022-08-12  3:15 UTC (permalink / raw)
  To: gdb-prs

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

Enze Li <lienze at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lienze at sourceware dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-12  3:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08  8:09 [Bug build/29455] New: [gdb/build, clang-13] undefined reference to `__atomic_load' vries at gcc dot gnu.org
2022-08-08  8:40 ` [Bug build/29455] " vries at gcc dot gnu.org
2022-08-08  9:01 ` vries at gcc dot gnu.org
2022-08-08 13:43 ` tromey at sourceware dot org
2022-08-08 15:09 ` vries at gcc dot gnu.org
2022-08-09  8:33 ` vries at gcc dot gnu.org
2022-08-09  8:46 ` vries at gcc dot gnu.org
2022-08-12  3:15 ` lienze at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).