From owner-svn-src-all@freebsd.org Sun Dec 20 04:27:44 2020 Return-Path: Delivered-To: svn-src-all@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 ADE2A4B77DB; Sun, 20 Dec 2020 04:27:44 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cz8hw4MNFz3ssJ; Sun, 20 Dec 2020 04:27:44 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qt1-f174.google.com with SMTP id a6so4508640qtw.6; Sat, 19 Dec 2020 20:27:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p4O4L2rdo5a+qvaOn0QjwXb+ogoQHRTTh0DhniDXUxY=; b=FKpfPKBNPl8Y0h9/YUVxjKVvdmWI4HOO+3Qfx8/Cc4nWikKOwgjTln/2bEuABLMl2N 41NUehPrDoRmCQTPxTwa7XOxruXIcZLVzxVBC/ciH5aP8bZaxJbIeXbdMazx4L2LygDl fJyORXNb3GW5JbfmRdEsQWfP2w6Wh+tEmogARe3pE4AXnVl6QIG2gZRMGJ/gACJegOpy X7UDBaEDIFEr/dvY4gxkofkxTJ4M74PEPLYkMgWVRBIoLrVWnrG2qdxYQ5z/lxH3ZlAJ 1vsIzlgmRKHVBbmNuAYLYDyQevSb5DiHZC5wt/LPaSi6p5VsI6QzSlYwDgY4EgQv5JFd T4Gw== X-Gm-Message-State: AOAM532XUoEjFUdPhen19sL2jDBwwJ391ZglCLa1uyRErlJECQl7tSjG qqPwzbjgJsby5AAvtzRECQfjxts/E8HQsQ== X-Google-Smtp-Source: ABdhPJyTAEQvfmLEVht+PV3zS4n5T2mg7kOFMeMRxj99/S98whrBuPsNsGE+cauF0s3s+Jd/XcD9DA== X-Received: by 2002:a05:622a:346:: with SMTP id r6mr11332747qtw.299.1608438463254; Sat, 19 Dec 2020 20:27:43 -0800 (PST) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com. [209.85.160.179]) by smtp.gmail.com with ESMTPSA id a10sm8868836qkk.52.2020.12.19.20.27.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Dec 2020 20:27:43 -0800 (PST) Received: by mail-qt1-f179.google.com with SMTP id c14so4535387qtn.0; Sat, 19 Dec 2020 20:27:42 -0800 (PST) X-Received: by 2002:ac8:70c:: with SMTP id g12mr11489375qth.140.1608438462633; Sat, 19 Dec 2020 20:27:42 -0800 (PST) MIME-Version: 1.0 References: <202012190838.0BJ8cVJ3064816@repo.freebsd.org> <47e9db0f-14b4-0a0d-45c4-7e466e69711f@FreeBSD.org> In-Reply-To: <47e9db0f-14b4-0a0d-45c4-7e466e69711f@FreeBSD.org> From: Ryan Libby Date: Sat, 19 Dec 2020 20:27:31 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368789 - head/libexec/rtld-elf/rtld-libc To: John Baldwin Cc: src-committers , svn-src-all , svn-src-head , Konstantin Belousov , Alex Richardson Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Cz8hw4MNFz3ssJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2020 04:27:44 -0000 On Sat, Dec 19, 2020 at 7:23 PM John Baldwin wrote: > > On 12/19/20 12:38 AM, Ryan Libby wrote: > > Author: rlibby > > Date: Sat Dec 19 08:38:31 2020 > > New Revision: 368789 > > URL: https://svnweb.freebsd.org/changeset/base/368789 > > > > Log: > > rtld-elf: link udivmoddi4 from compiler_rt > > > > This fixes the gcc9 build of rtld-elf32 on amd64, which needed an > > implementation of udivmoddi4. > > > > rtld-elf uses certain functions normally found in libc, and so it > > includes certain files from libc in its own build. It has two > > mechanisms to include files from libc: one that rebuilds source files in > > the rtld-elf environment, and one that extracts object files from a > > purpose-built no-SSP PIC archive. > > > > In addition to libc functions, rtld-elf may need to link functions > > normally found in libcompiler_rt (formerly libgcc). Now, add an ability > > to rebuild libcompiler_rt source files in the rtld-elf environment. We > > don't yet have a need for an object file extraction mechanism. > > > > libcompiler_rt could also supply udivdi3 and umoddi3, but leave them > > alone for now. > > > > Reviewed by: arichardson, kib > > Sponsored by: Dell EMC Isilon > > Differential Revision: https://reviews.freebsd.org/D27665 > > Hmm, I had just linked against libcompiler_rt directly as we do on arm: > > https://reviews.freebsd.org/D26199 > > It was stuck waiting for review feedback. > > Given libcompiler_rt is a static archive, we could probably safely link > against it directly unlike libc where we have to pick specific object > files. > > -- > John Baldwin Sorry, I wasn't aware of your review. Do you want this backed out? I did see the arm path. I think it is not quite right, because libcompiler_rt is compiled with -fstack-protector-strong, which is not compatible with rtld. However, it will work in practice if stack protection doesn't actually get used on any linked function. We could build a special libcompiler_rt with no stack protection like we do just for rtld with libc, but since we'd only want this no-SSP library for rtld, that's not much different from just rebuilding its source files in rtld. In addition, by rebuilding specific files we avoid overlinking--although that may not be a big deal (?), and there may be other cleaner ways to avoid that (?). On a tangent, it might be neat to split out an rtld_bootstrap (everything through init_rtld()) so that only the bootstrap code needs to be compiled and linked with no-SSP. I looked at this some but I figured there might not be appetite for a bunch of reorganization of rtld just to enable SSP. Anyway the bootstrap code would still need these particular libcompiler_rt functions to be no-SSP, as they get used in the printf procedure, which I am guessing the bootstrap may need. Ryan