From owner-dev-commits-src-main@freebsd.org Mon Dec 28 08:47:43 2020 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 841634D4BBA; Mon, 28 Dec 2020 08:47:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4B5C3KdSz4sPj; Mon, 28 Dec 2020 08:47:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6542016C29; Mon, 28 Dec 2020 08:47:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BS8lhRL041040; Mon, 28 Dec 2020 08:47:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BS8lhkd041039; Mon, 28 Dec 2020 08:47:43 GMT (envelope-from git) Date: Mon, 28 Dec 2020 08:47:43 GMT Message-Id: <202012280847.0BS8lhkd041039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: 63f93c7e11e3 - main - rtld-elf: link libcompiler_rt on all architectures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63f93c7e11e33149429ddc2831cd1683b2e7f3e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2020 08:47:43 -0000 The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=63f93c7e11e33149429ddc2831cd1683b2e7f3e1 commit 63f93c7e11e33149429ddc2831cd1683b2e7f3e1 Author: Ryan Libby AuthorDate: 2020-12-28 08:44:25 +0000 Commit: Ryan Libby CommitDate: 2020-12-28 08:44:25 +0000 rtld-elf: link libcompiler_rt on all architectures Statically link rtld-elf with libcompiler_rt on all architectures so that we don't need to try to pick and choose the bits we need from it for each architecture (we now leave that to the linker). Compilers may emit calls to support functions in this library, but because of the use of the linker flag -nostdlib for rtld's special needs, the library is not linked as normal. Previously we had two different solutions. On some architectures, we were able to extract reimplementations of the necessary builtin functions from our special build of libc. On ARM, we just linked libcompiler_rt. This is motivated by the same issue as D26199 and D27665, but should be a simpler solution that will apply to all architectures. Reviewed by: arichardson, kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27736 --- libexec/rtld-elf/Makefile | 4 ++++ libexec/rtld-elf/arm/Makefile.inc | 5 ----- libexec/rtld-elf/rtld-libc/Makefile.inc | 16 ++++------------ 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index c61477c68236..9ae998942a12 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -82,6 +82,10 @@ HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .endif +# Some of the required math functions (div & mod) are implemented in +# libcompiler_rt on some architectures. +LIBADD+= compiler_rt + .include ${PROG_FULL}: ${VERSION_MAP} .include diff --git a/libexec/rtld-elf/arm/Makefile.inc b/libexec/rtld-elf/arm/Makefile.inc index 25bd4120edae..f39f1e89a8eb 100644 --- a/libexec/rtld-elf/arm/Makefile.inc +++ b/libexec/rtld-elf/arm/Makefile.inc @@ -1,8 +1,3 @@ # $FreeBSD$ -# Some of the required math functions (div & mod) are implemented in -# libcompiler_rt on ARM. The library also needs to be placed first to be -# correctly linked. As some of the functions are used before we have -# shared libraries. -LIBADD+= compiler_rt CFLAGS+= -mfpu=none diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc index 88f13c8db8cb..d682472c3cca 100644 --- a/libexec/rtld-elf/rtld-libc/Makefile.inc +++ b/libexec/rtld-elf/rtld-libc/Makefile.inc @@ -57,22 +57,14 @@ _libc_other_objects= sigsetjmp lstat stat fstat fstatat fstatfs syscall \ # ARM needs aeabi_unwind_cpp for _setjmp _libc_other_objects+=aeabi_unwind_cpp .elif ${LIBC_ARCH} == "i386" -# __udivdi3 is needed by kvprintf() in rtld_printf.c -# i386 also needs i386_set_gsbase for allocate_initial_tls() -_libc_other_objects+=umoddi3 udivdi3 qdivrem i386_set_gsbase +# i386 needs i386_set_gsbase for allocate_initial_tls() +_libc_other_objects+=i386_set_gsbase .elif ${LIBC_ARCH} == "powerpc" || ${LIBC_ARCH} == "powerpcspe" -# ppc needs __syncicache for reloc.c and __umoddi3+__udivdi3 for rtld_printf.c -_libc_other_objects+=syncicache umoddi3 udivdi3 qdivrem -# for some reason there is also a reference to abs() -_libc_other_objects+=abs +# ppc needs __syncicache and abs for reloc.c +_libc_other_objects+=syncicache abs .elif ${LIBC_ARCH} == "powerpc64" # ppc64 needs __syncicache for reloc.c _libc_other_objects+=syncicache -.elif ${LIBC_ARCH} == "mips" -# 32-bit MIPS needs __umoddi3+__udivdi3 for rtld_printf.c -.if ${MACHINE_ARCH:Mmipsn32*} == "" && ${MACHINE_ARCH:Mmips64*} == "" -_libc_other_objects+=umoddi3 udivdi3 qdivrem -.endif .endif # Extract all the .o files from libc_nossp_pic.a. This ensures that