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 6D0AA3851C2A for ; Tue, 22 Sep 2020 17:55:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6D0AA3851C2A 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 9B6F94069C; Tue, 22 Sep 2020 12:55:15 -0500 (CDT) Received: from zmcc-2.zmailcloud.com (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPS id 29CADCE886; Tue, 22 Sep 2020 12:55:15 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTP id 11470CE863; Tue, 22 Sep 2020 12:55:15 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.10.3 zmcc-2-mta-1.zmailcloud.com 11470CE863 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=symas.com; s=37C7994C-28CA-11EA-A30F-68F90BB9D764; t=1600797315; bh=5reu83UULRCQo0rYr/G4MDgIm++C6Gp0gUmZclYvFK0=; h=To:From:Message-ID:Date:MIME-Version; b=X/PmdqHz+825sM1Q4Ws3tr8OG7RJyix5Ff1vPC8koBuyNmnxYcC3hy37dHlYPuyie kAdT+GPeeJXLW7qSAZn9D80de/HLiCS/2+h5c4Cgg30UqMhmwClHmQTnYHVuZmgRNn DmyeXre7U3Ef21UglDK6BeECwnwYEBAHlkI9sbNyNcc9xB8bIlxdE4flT41OqI7OxG crELrJSsK3jf5gNdJh4Jk93Z/hx0ecL+/PZpPpscwuEmPaiHYCIeLJrH7R6WzcDIsJ WckYqF0DuwhV5Ni1uWanhrEs8fppoEQQWnMurjUjb/+mS39YeEhh11u8qsdgREXGwc S+Q9+2T8/Lu6w== 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 7r07JSFSYn7n; Tue, 22 Sep 2020 12:55:15 -0500 (CDT) Received: from [192.168.1.155] (unknown [84.203.28.168]) by zmcc-2-mta-1.zmailcloud.com (Postfix) with ESMTPSA id 0232ECE54A; Tue, 22 Sep 2020 12:55:13 -0500 (CDT) Subject: Re: [PATCH] dependency list for static libraries To: Fangrui Song Cc: Nick Clifton , binutils@sourceware.org References: <53b8973b-40a4-2550-3307-66d7f13707d5@symas.com> <64fe82bd-9c00-b232-98d2-f46182fb16ba@symas.com> <9889c54b-4dd3-2275-6621-c2391cfd268d@redhat.com> <20200922171638.kkapdimub5iled5o@gmail.com> From: Howard Chu Message-ID: <8572bf86-13f1-ab92-ff24-24111c2ddb85@symas.com> Date: Tue, 22 Sep 2020 18:55:11 +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: <20200922171638.kkapdimub5iled5o@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 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, URI_HEX 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: Tue, 22 Sep 2020 17:55:18 -0000 Fangrui Song wrote: > Did the thread start at > https://sourceware.org/legacy-ml/binutils/2017-09/msg00158.html ? Yes. > > If all dependencies are specified on the command line but there are > "backward references", we can step back and think about loosing the > requirement like some other binary formats: > https://sourceware.org/pipermail/binutils/2020-September/113194.html "Memoryless" archive processing of ld Seems unrelated. > If some archives want system libraries (e.g. -lm -lpthread), MSVC style > #pragma comment(lib, "pthread") > may be convenient. clang supports the syntax for ELF and the syntax has > been used in several places in libc++. LLD supports .deplibs ( > http://lists.llvm.org/pipermail/llvm-dev/2019-March/131004.html > http://llvm.1065342.n5.nabble.com/llvm-dev-RFC-ELF-Autolinking-td126998.html ) This seems misguided and wasteful, IMO. You'll have redundant info embedded in each of the object files that are built for a library, but you only need these dependencies to be specified once - at the library level itself. This problem is already solved for shared libraries. They have their dependencies listed in their dynamic section, and it's specified once at library build time. That's the correct approach. My aim here is to make static libraries behave the same as shared libraries, in this respect. Embedding dependent library info in source files is just wrong, particularly when you write code that's cross-platform. It makes sense that Microsoft would latch on to an idea like this, since in their worldview they are the sole provider of useful libraries for their systems. But it doesn't make sense for portable cross-platform code. -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/