From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by sourceware.org (Postfix) with ESMTPS id D8AB93942021 for ; Thu, 12 Mar 2020 09:36:42 +0000 (GMT) Received: by mail-oi1-x241.google.com with SMTP id d62so4788506oia.11 for ; Thu, 12 Mar 2020 02:36:42 -0700 (PDT) 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=GSH8v32fKq+vNKumZSrziKcvQ/hmM5H+ezkyzeEPmlg=; b=KLlUAsyTn4uyj2X0gbBAwJI5yXoZkeBZHqicbo406KaUH29qUfU7M6E6toFuIR3R2n msS++2cIBApvs5nc2mfxaBAW3NDdr/VPVNUe8puFxIeNMken01bhhq3w4IRIWm+tT2aT rFa8Lsk4wStx+o6+XOAisFnLk1T32vF1NOhM9fg2osOxBVu/dC02k/YYdv0tgILUrUCy lFLWILM59AjhrKHd+ZxjBaIuWKdNMkTkqxMgGHxWZgJmedE15txdjnCPJqicgUGIt7tA u1q5Va4xI3EwlhORRYREBWfKuLpwzBHqr9MOcgvEZ7CxIoPIOe1fbqroZq2caYG6h8aY bCng== X-Gm-Message-State: ANhLgQ2zNnM/RhIwtkXSGg62HNzwq08FeLAacqSsgzGdPQIxnd5YuKZP ztE8AYi1Uz70O2iur94QLiD1XHqu22M1G+pPUwM= X-Google-Smtp-Source: ADFU+vuyyhl5aDs2dV6CqHUv9p0/+oFdaa4BU1qE/nph/D9DAdXfAO+gVqPNvi9HppvXuaSEAbqiT3FEL4tSkBznYt4= X-Received: by 2002:aca:8ce:: with SMTP id 197mr1812507oii.35.1584005802261; Thu, 12 Mar 2020 02:36:42 -0700 (PDT) MIME-Version: 1.0 References: <20200311235752.406955-1-hjl.tools@gmail.com> <20200312041900.GF5384@bubble.grove.modra.org> In-Reply-To: <20200312041900.GF5384@bubble.grove.modra.org> From: "H.J. Lu" Date: Thu, 12 Mar 2020 02:36:06 -0700 Message-ID: Subject: Re: [PATCH] ld: Properly check static link of dynamic object To: Alan Modra Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2020 09:36:44 -0000 On Wed, Mar 11, 2020 at 9:19 PM Alan Modra wrote: > > On Wed, Mar 11, 2020 at 04:57:52PM -0700, H.J. Lu via Binutils wrote: > > When -static is passed to gcc, gcc passes it to linker before any input > > files to create static executable. If -Bdynamic is also passed to linker > > from command-line, linker should issue an error if dynamic object is used. > > I can't say I like the idea of giving -static special meaning when it > occurs before input files, making its effect sticky. The sticky > effect just seems wrong to me and liable to break some project > somewhere. > > PR 24920 is really just a user being surprised when they misuse their > tools. That and the default dynamic linker being wrong. Why not fix > the x86_64 default dynamic linker? > I want to use the generic x86-64 ELF backend for Linux. I will see if I can just do -static for x86. Besides, when -static is passed to GCC driver, I don't think -Wl,-Bdynamic can completely override it at the linker command-line. -- H.J.