Commit Graph

104 Commits

Author SHA1 Message Date
John Baldwin
47e888f836 Remove a few more references to riscv64sf.
Fixes:		1ca12bd927 Remove the riscv64sf architecture.
2023-04-20 11:00:46 -07:00
John Baldwin
1ab9996fb5 libcompiler_rt/libgcc_s: Remove MIPS build glue.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39328
2023-03-29 15:05:42 -07:00
Ed Maste
96ab5023fd compiler-rt: remove eprintf
It was used by ancient GCC assert.h.  Prior to 2001 GCC used to provide
its own assert.h  The GCC assert.h required __eprintf to emit the error
message.  FreeBSD's own assert.h never used this.

Reviewed by:	ed (previously), imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2597
2023-03-14 13:13:51 -04:00
Warner Losh
ae902a5be9 libc: Simplify soft-float on 32-bit arm
Simplify the tests for 32-bit arm soft float support. For the files
included only on arm, drop the test entirely. For others, test
MACHINE_CPUARCH against arm.

No functional change intended. File lists appear the same before / after
the change.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D38582
2023-02-14 09:53:08 -07:00
Dimitry Andric
7ecd99fa42 Build compiler-rt against libunwind, not libcxxrt
Parts of compiler-rt are also built for libgcc_eh and libgcc_s, and
these were already pointing to the libunwind unwind.h. For the sake of
consistency, also build compiler-rt itself against the libunwind
unwind.h, not the libcxxrt one.

MFC after:	3 days
2022-03-09 22:23:35 +01:00
Dimitry Andric
6e75b2fbf9 Merge llvm-project release/13.x llvmorg-13.0.0-rc1-97-g23ba3732246a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13.0.0-rc1-97-g23ba3732246a.

PR:		258209
MFC after:	2 weeks
2021-11-13 21:42:03 +01:00
Dimitry Andric
efe67f33c3 compiler-rt: add aarch64 init function for LSE atomics
As reported by Ronald, adding the out-of-line LSE atomics helpers for
aarch64 to compiler-rt was not sufficient to link programs using these,
as they also require a __aarch64_have_lse_atomics global. This is
initialized in compiler-rt's lib/builtins/cpu_model.c, roughly similar
to the x86 CPU model and feature detection in that file.

Since upstream does not yet have a FreeBSD specific implementation for
getting the required information, add a simple one that should work for
now, while I try to get it sorted with the LLVM people.

Reported by:	Ronald Klop <ronald-lists@klop.ws>
Fixes:		cc55ee8009
PR:		257392
MFC after:	2 weeks
2021-09-06 21:24:01 +02:00
Dimitry Andric
cc55ee8009 compilert-rt: build out-of-line LSE atomics helpers for aarch64
Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for
aarch64. This requires a bunch of helper functions in libcompiler_rt.a,
to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel".

(Note: of course you can use -mno-outline-atomics as a workaround too,
but this would negate the potential performance benefit of the faster
LSE instructions.)

Bump __FreeBSD_version so ports maintainers can easily detect this.

PR:		257392
MFC after:	2 weeks
2021-07-28 22:30:04 +02:00
Alex Richardson
7fa2f2a62f Rename NO_WERROR -> MK_WERROR=no
As suggested in D27598. This also supports MK_WERROR.clang=no and
MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D27601
2021-01-07 09:31:03 +00:00
Ryan Libby
a723bb667e libcompiler_rt: stop building with stack smashing protection
libcompiler_rt implements certain functions that clang and gcc emit
calls to as part of their codegen (e.g. for extended width math).  Build
it without stack smashing protection (SSP, -fstack-protector) in order
to support building binaries without SSP, especially the dynamic linker.
Besides, SSP is probably not very valuable in this library.

Reviewed by:	arichardson, dim, kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27786
2020-12-28 00:44:25 -08:00
Dimitry Andric
18ed63b8f1 Follow-up r364753 by only using arm's stdatomic.c implementation, as it
already covers the functions in compiler-rt's atomic.c, leading to
conflicts when linking.

PR:		230888
MFC after:	3 days
X-MFC-With:	r364753
2020-09-10 16:47:12 +00:00
Dimitry Andric
c90cb43503 Follow-up r364753 by enabling compiler-rt's atomic implementation only
for clang, as it uses clang specific builtins, and does not compile
correctly with gcc. Note that gcc packages usually come with their own
libatomic, providing these primitives.

PR:		230888
MFC after:	3 days
X-MFC-With:	r364753
2020-09-09 20:48:57 +00:00
Dimitry Andric
0709bb1f41 After r364753, there should be no need to suppress -Watomic-alignment
warnings anymore for compiler-rt's atomic.c. This occurred because the
IS_LOCK_FREE_8 macro was not correctly defined to 0 for mips, and this
caused the compiler to emit a runtime call to __atomic_is_lock_free(),
and that triggers the warning.

MFC after:	2 weeks
X-MFC-With:	r364753
2020-08-25 19:57:11 +00:00
Dimitry Andric
46c8c5540f Add atomic and bswap functions to libcompiler_rt
There have been several mentions on our mailing lists about missing
atomic functions in our system libraries (e.g. __atomic_load_8 and
friends), and recently I saw __bswapdi2 and __bswapsi2 mentioned too.

To address this, add implementations for the functions from compiler-rt
to the system compiler support libraries, e.g. libcompiler_rt.a and and
libgcc_s.so.

This also needs a small fixup in compiler-rt's atomic.c, to ensure that
32-bit mips can build correctly.

Bump __FreeBSD_version to make it easier for port maintainers to detect
when these functions were added.

MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D26159
2020-08-25 06:49:10 +00:00
Alex Richardson
0b862b0399 Avoid adding duplicates to SRCS/OBJS/SOBJS/POBJS
This is a change in preparation for stopping to use lorder.sh (D26044) and
instead assume that we have a linker newer than ~1990. Without lorder.sh
duplicates end up being passed to the linker when building .so files and this
can result in duplicate symbol definition errors.

There is one minor change: libcompiler_rt.a will no longer provide
gcc_personality_v0 and instead we now only have it in libgcc_eh.a/libgcc_s.so.
This matches GCC's behaviour.

Reviewed By:	emaste, cem
Differential Revision: https://reviews.freebsd.org/D26042
2020-08-24 09:20:33 +00:00
Dimitry Andric
44e86fbdcf Merge ^/head r357662 through r357854. 2020-02-13 12:52:24 +00:00
Warner Losh
f0df5b8f27 Remove sparc64 specific inclusion of bswap32 built-ins. 2020-02-12 06:56:04 +00:00
Dimitry Andric
a92579cfb9 Add internal floating point environment builtins to libcompiler_rt and
libgcc, as these are used in a few other builtin implementations.
2020-01-28 19:07:37 +00:00
Dimitry Andric
8bc12a7e28 Sort libcompiler_rt sources. 2020-01-27 20:12:03 +00:00
Justin Hibbits
7b6b882fe4 [PowerPC] enable atomic.c in compiler_rt and do not check and forces
lock/lock_free decisions in compiled time

Summary:
Enables atomic.c in compiler_rt and forces clang to not emit a call for runtime
decision about lock/lock_free.  At compiling time, if clang can't decide if
atomic operation can be lock free, it emits calls to external functions  like
`__atomic_is_lock_free`, `__c11_atomic_is_lock_free` and
`__atomic_always_lock_free`, postponing decision to a runtime check.  According
to LLVM code documentation, the mechanism exists due to differences between
x86_64 processors that can't be decided at runtime.

On PowerPC and PowerPCSPE (32 bits), we already know in advance it can't be lock
free, so we force the decision at compile time and avoid having to implement it
in an external library.

This patch was made after 32 bit users testing the PowePC32 bit ISO reported
llvm could not be compiled with in-base llvm due to `__atomic_load8` not
implemented.

Submitted by:	alfredo.junior_eldorado.org.br
Reviewed by:	jhibbits, dim

Differential Revision:	https://reviews.freebsd.org/D22549
2019-12-26 23:06:28 +00:00
Dimitry Andric
0b57cec536 Move all sources from the llvm project into contrib/llvm-project.
This uses the new layout of the upstream repository, which was recently
migrated to GitHub, and converted into a "monorepo".  That is, most of
the earlier separate sub-projects with their own branches and tags were
consolidated into one top-level directory, and are now branched and
tagged together.

Updating the vendor area to match this layout is next.
2019-12-20 19:53:05 +00:00
John Baldwin
3487d66820 Define __SOFT_FP__ for riscv64sf to avoid infinite recursion.
Submitted by:	James Clarke <jrtc27@jrtc27.com>
Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D22660
2019-12-04 20:18:12 +00:00
Conrad Meyer
c8b5e3de39 Fix llvm-libunwind userspace build on ARM
GCC's libgcc exports a few ARM-specific symbols for ARM EABI, AEABI, or
EHABI or whatever it's called.  Export the same ones from LLVM-libunwind's
libgcc_s, on ARM.  As part of this, convert libgcc_s from a direct
Version.map to one constructed from component Symbol.map files.  This allows
the ARM-specific Symbol.map to be included only on ARM.

Fix ARM-only oddities in struct name/aliases in LLVM-libunwind to match
non-ARM definitions and ARM-specific expectations in libcxxrt /
libcompiler_rt.

No functional change intended for non-ARM architectures.

This commit does not actually flip the switch for ARM defaults from libgcc
to llvm-libunwind, but makes it possible (to compile, anyway).
2019-11-05 03:20:40 +00:00
Dimitry Andric
91baa74420 Update build glue for building compiler-rt. 2019-08-29 20:39:24 +00:00
Ed Maste
ea0a30b145 compiler-rt: enable __bswapsi2/__bswapdi2 for RISC-V
As with other archs the compiler may emit calls to the byte swap routines
under certain conditions.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-08-14 18:41:28 +00:00
Warner Losh
0fd19f4a95 The routines defined in comparedf2 and comparesf2 are defined in libc
for softfloat mips. No need to include them here.
2018-02-02 05:04:43 +00:00
Warner Losh
0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00
Dimitry Andric
2b12718be6 Follow-up to r323001: if the actually selected CPUTYPE is capable of
SSE2 instructions, we can use them.

Suggested by:	jkim
PR:		221733
MFC after:	1 week
X-MFC-With:	r323001
2017-08-30 07:05:29 +00:00
Dimitry Andric
e1ca2b88e2 In compiler-rt, a few assembler implementations for i386 floating point
conversion functions use SSE2 instructions, but these are not guarded by
#ifdef __SSE2__, and there is no implementation using general purpose
registers.  For these functions, use the generic C variants instead,
otherwise they will cause SIGILL on older processors.

Reported by:	bsdpr@phoe.frmug.org
PR:		221733
MFC after:	1 week
2017-08-29 21:45:00 +00:00
John Baldwin
04a91333db Include {u,}{div,mod}si3() on mips in libcompiler_rt.
These builtins were listed in the mips-specific Symbol.map for libc but
were not implemented.  Compiling mips with recent clang requires these
symbols.

Sponsored by:	DARPA / AFRL
2017-08-21 17:49:01 +00:00
Warner Losh
b53a8df3aa There is no MACHINE_CPUARCH == armv6, remove redunant check. 2017-08-14 22:38:54 +00:00
Dimitry Andric
d2043ca373 Merge ^/head r320573 through r320970. 2017-07-13 22:01:38 +00:00
Ed Maste
d9ad2b357b compiler_rt: provide bswap buildins on sparc64
Attempting to build sparc64 world with GCC 6.3 previously failed with
zstd_compress.c:(.text+0x8fc): undefined reference to `__bswapsi2'
2017-07-06 13:27:01 +00:00
Dimitry Andric
27c240688c Merge ^/head r318560 through r318657. 2017-05-22 19:28:24 +00:00
Adrian Chadd
66ed774149 [libcompiler-rt] add bswapdi2/bswapsi2
This is required for mips gcc 6.3 userland to build/run.

Reviewed by:	emaste, dim
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D10838
2017-05-21 23:15:32 +00:00
Dimitry Andric
289fa303d6 Merge compiler-rt trunk r300890, and update build glue. 2017-04-22 18:43:15 +00:00
John Baldwin
813b8a9e89 Add an implementation of __ffssi2() derived from __ffsdi2().
Newer versions of GCC include an __ffssi2() symbol in libgcc and the
compiler can emit calls to it in generated code.  This is true for at
least GCC 6.2 when compiling world for mips and mips64.

Reviewed by:	jmallett, dim
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D10086
2017-04-05 02:40:53 +00:00
Dimitry Andric
d006dde2fd Gcc has incompatible internal declarations for __divtc3 and __multc3 as
defined in compiler-rt, but it has no option to silence its warning, so
make gcc warnings for libcompiler_rt non-fatal.

Noticed by:	lwhsu
MFC after:	3 days
2017-03-21 21:07:37 +00:00
Jung-uk Kim
d751009457 Remove an assembler flag, which is redundant since r309124. The upstream
took care of it by introducing a macro NO_EXEC_STACK_DIRECTIVE.

http://llvm.org/viewvc/llvm-project?rev=273500&view=rev

Reviewed by:	dim
2017-02-23 17:46:38 +00:00
Dimitry Andric
29a85f30b7 Update compiler-rt to release_39 branch r288513. Since this contains a
rather unfortunate upstream workaround for an unwind header problem that
does not exist on FreeBSD, but which causes an unnecessary warning for
us, add some flags to the compiler-rt Makefile to suppress the warning.
2016-12-02 20:17:41 +00:00
Dimitry Andric
67bc8c8b9e Merge ^/head r308491 through r308841. 2016-11-19 16:05:55 +00:00
Ruslan Bukin
7804dd5212 Add full softfloat and hardfloat support for RISC-V.
Hardfloat is now default (use riscv64sf as TARGET_ARCH
for softfloat).

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8529
2016-11-16 15:21:32 +00:00
Dimitry Andric
2828dafcf3 Merge ^/head r308227 through r308490. 2016-11-10 22:12:19 +00:00
Ruslan Bukin
2ad1d09f16 o Add support for long double.
o Add support for latest RISC-V GNU toolchain.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-11-03 13:06:17 +00:00
Ed Maste
335bcabec9 Merge ^/head r306303 through 306411. 2016-09-28 19:29:01 +00:00
Ed Maste
040b30497c libcompiler_rt: move file list to Makefile.inc for reuse elsewhere
Also switch to the style used in the clang390-import branch to reduce
future conflicts.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8039
2016-09-27 18:55:45 +00:00
Ed Maste
d7e002ff96 libcompiler_rt: use ${SRCTOP} for the top of the FreeBSD tree 2016-09-23 13:23:52 +00:00
Dimitry Andric
2a0eade7f4 Fix building some arm-specific primitives for libcompiler_rt. This was
an unfortunate search and replace error.
2016-09-05 17:20:12 +00:00
Dimitry Andric
53b715b5ba Update compiler-rt to 3.9.0 release, and update the build glue for
libcompiler_rt and libclang_rt.
2016-09-03 21:41:29 +00:00
Warner Losh
2c0e9e2a09 Make armv6 hard float abi by default. Kill armv6hf.
Allow CPUTYPE=soft to build the current soft-float abi libraries.
Add UPDATING entry to announce this.

Approved by: re@ (gjb)
2016-05-18 06:01:18 +00:00