From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id EBA0B3858C56 for ; Wed, 6 Jul 2022 11:32:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBA0B3858C56 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 0E0F31FE2D; Wed, 6 Jul 2022 11:32:30 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E22F82C141; Wed, 6 Jul 2022 11:32:29 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id D859E6800; Wed, 6 Jul 2022 11:32:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id D76EA67FC; Wed, 6 Jul 2022 11:32:29 +0000 (UTC) Date: Wed, 6 Jul 2022 11:32:29 +0000 (UTC) From: Michael Matz To: Stephan Bergmann cc: binutils@sourceware.org Subject: Re: Deliberate deduplication of -rpath arguments in ld.bfd and ld.gold? In-Reply-To: <38ff8f84-c34c-8a90-6070-4cbe62835940@redhat.com> Message-ID: References: <38ff8f84-c34c-8a90-6070-4cbe62835940@redhat.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Wed, 06 Jul 2022 11:32:32 -0000 Hello, On Wed, 6 Jul 2022, Stephan Bergmann via Binutils wrote: > Over in the comments at "[LLD][ELF] Drop > duplicates from rpath" we wonder what the rationale might be that both ld.bfd > and ld.gold apparently deliberately drop duplicated -rpath arguments with > identical paths The rationale would be "avoid waste in the real world". If you don't do that then you will find that when building certain software it will end up with hundreds of copies of things like "RUNPATH /usr/lib/my-strange-module-path/" because its build-system is strange, and blindly collects linker arguments from e.g. pkg-config files, but doesn't remove duplicates itself. As the runtime linker doesn't do duplicate removal either (speed!) it would then end up looking into loading the same non-existing file that same hundred times. Instead of fixing all these build systems, something simply has to remove the duplicates and the linker is the most sensible choice. Ciao, Michael.