From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zmcc-2-mx.zmailcloud.com (zmcc-2-mx.zmailcloud.com [52.37.197.7]) by sourceware.org (Postfix) with ESMTPS id 8DA353857C59 for ; Mon, 28 Sep 2020 11:07:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8DA353857C59 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=symas.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hyc@symas.com Received: from zmcc-2.zmailcloud.com (zmcc-2-mta-1.zmailcloud.com [146.148.52.56]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by zmcc-2-mx.zmailcloud.com (Postfix) with ESMTPS id A4FCF4064E; Mon, 28 Sep 2020 06:07:44 -0500 (CDT) Received: from zmcc-2.zmailcloud.com (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPS id 2E895CFEBE; Mon, 28 Sep 2020 06:07:44 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTP id 16293CFEBD; Mon, 28 Sep 2020 06:07:44 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.10.3 zmcc-2-mta-1.zmailcloud.com 16293CFEBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=symas.com; s=37C7994C-28CA-11EA-A30F-68F90BB9D764; t=1601291264; bh=bZFRYR1ir6f4Ic1tRkTnEMr3xX5uD1OxwWhFBvA9seU=; h=From:To:Message-ID:Date:MIME-Version; b=Q8DjCNSzBfYEJSlPk6vCu8ikb3A7d/tQsbcu4E25vulGvgY4A+eyKueKhuhmo5rUT oAJezRIXyXAL7yeUyQN7Ygbxec3pIxpHtBx9PASU3sqG815GD26lrQUN08KKQ0D/st XM0TMeYJjhkl3+lzyUyK4cnGJg7PTiikSfglEeudgHAR9wxYTCuvGC1zEk2bUTLgVd Cq6cIf+FCGukl+Yy1c2kBGvnFqAlIl/P7LV6zv5QpQKrcJH+yNmaWc6vTczJAOB0LV 9YndXx7AegpdbI78dqIBu9aU/mfnnGtyJMTfYDz60e6an/YAmIWjxBt4g8I83Iw0Vl IhHPw78kofFMw== Received: from zmcc-2.zmailcloud.com ([127.0.0.1]) by localhost (zmcc-2-mta-1.zmailcloud.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uLp1N2U-1HDO; Mon, 28 Sep 2020 06:07:44 -0500 (CDT) Received: from [192.168.1.155] (unknown [84.203.28.168]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPSA id 99B7ACFEBA; Mon, 28 Sep 2020 06:07:43 -0500 (CDT) Subject: Re: [PATCH] dependency list for static libraries From: Howard Chu To: Fangrui Song Cc: binutils@sourceware.org References: <64fe82bd-9c00-b232-98d2-f46182fb16ba@symas.com> <9889c54b-4dd3-2275-6621-c2391cfd268d@redhat.com> <31f9062e-175d-06e9-695a-797c7ee11420@symas.com> <58620dc1-3bb9-aaae-b476-ebb613ecb627@redhat.com> <20200924052111.3i5codebro4qqxia@gmail.com> <37636222-1f01-068f-41e0-a3f3f660506b@symas.com> Message-ID: Date: Mon, 28 Sep 2020 12:07:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.3 MIME-Version: 1.0 In-Reply-To: <37636222-1f01-068f-41e0-a3f3f660506b@symas.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_RED 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: Mon, 28 Sep 2020 11:07:47 -0000 Howard Chu wrote: > Fangrui Song wrote: >> =C2=A0 + The executable does not references B. I am still unsure why y= ou want to move the dependency information from the >> =C2=A0=C2=A0=C2=A0 object file to the archive. >=20 > The most common case is we reference a library we know about, and it ha= s dependencies > we don't know about. An example I currently have in mind is libzmq, whi= ch may or may > not be built against libsodium, and may or may not have other library d= ependencies > as well. The "traditional" solution to this for the past couple decades= has been to > use pkg-config or libtool .la files to propagate this information but t= hose are both > ugly hacks that require excessive tooling to support. The information c= learly belongs > to the archive file itself. The libzmq/libsodium example is particularly illustrative. The symbols li= bzmq references may be entirely resolved by its bundled TweetNaCl, or may be satisfied by= libsodium. The choice of which to use is made at build time and either one can be substi= tuted in without making any alterations to source code or other build scripts, or recompil= ing any sources. As such, embedding the name of a dependency into libzmq's object files is= not a solution for this situation. The knowledge only exists at build time, chosen by wh= oever is packaging the software. It would be ridiculous to require the library to be recompi= led to change this embedded dependency, when no such step was needed before. There's another argument of perspective - there's a multi-decade expectat= ion that object files are passive, with no side effects. If I reference foo.o in a link c= ommand, all I get is foo.o, nothing else. There's also an expectation that if I referen= ce a library in a link command, I may get arbitrarily many other components. That's a fun= damental difference between individual object files and objects collected into a library. It = would be a mistake to violate these norms. --=20 -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/