From owner-freebsd-questions@freebsd.org Fri Nov 22 08:23:01 2019 Return-Path: Delivered-To: freebsd-questions@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 6919C1B16BB for ; Fri, 22 Nov 2019 08:23:01 +0000 (UTC) (envelope-from SRS0=RgOT=ZO=mail.sermon-archive.info=doug@sermon-archive.info) Received: from mail.sermon-archive.info (sermon-archive.info [71.177.216.148]) by mx1.freebsd.org (Postfix) with ESMTP id 47K8ZD5C6Wz4VXZ for ; Fri, 22 Nov 2019 08:23:00 +0000 (UTC) (envelope-from SRS0=RgOT=ZO=mail.sermon-archive.info=doug@sermon-archive.info) Received: from [10.0.1.251] (mini [10.0.1.251]) by mail.sermon-archive.info (Postfix) with ESMTPSA id 47K8ZB2pg6z2fjRy for ; Fri, 22 Nov 2019 00:22:58 -0800 (PST) From: Doug Hardie Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Linking to a static library and replacing modules Message-Id: Date: Fri, 22 Nov 2019 00:22:58 -0800 To: FreeBSD Questions X-Mailer: Apple Mail (2.3445.104.11) X-Virus-Scanned: clamav-milter 0.101.4 at mail X-Virus-Status: Clean X-Rspamd-Queue-Id: 47K8ZD5C6Wz4VXZ X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of SRS0=RgOT=ZO=mail.sermon-archive.info=doug@sermon-archive.info designates 71.177.216.148 as permitted sender) smtp.mailfrom=SRS0=RgOT=ZO=mail.sermon-archive.info=doug@sermon-archive.info X-Spamd-Result: default: False [-1.38 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.969,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:71.177.216.148]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; NEURAL_HAM_LONG(-0.91)[-0.912,0]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(-0.10)[asn: 5650(-0.46), country: US(-0.05)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[148.216.177.71.list.dnswl.org : 127.0.10.0]; MV_CASE(0.50)[]; FORGED_SENDER(0.30)[bc979@lafn.org,SRS0=RgOT=ZO=mail.sermon-archive.info=doug@sermon-archive.info]; RCVD_NO_TLS_LAST(0.10)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5650, ipnet:71.177.216.0/23, country:US]; FROM_NEQ_ENVFROM(0.00)[bc979@lafn.org,SRS0=RgOT=ZO=mail.sermon-archive.info=doug@sermon-archive.info]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 08:23:01 -0000 I have a collections of modules linked into a static library. These are = called from other modules compiled separately from the library. There = are 3 stub modules in the library. The point was that they are called = by other modules in the library. Often an application need to replace = one or more of the stubs with a module that does some real work. In the = past the loader just linked the new modules in place of the old one. = However, now it seems to be a bit more random. I have one program where = it links the way I want. Others the loader returns a duplicate symbol = error and dies. I can't find any differences between those two = situations. For the time being, I removed the 3 stubs from the library = and force the users to include them. It works, but it is not elegant. =20= How do you build a library such that lld will replace modules in the = library if there is a replacement in the user's code? I found a few = things that appear to be more Linux based and tried them. None of them = worked. I am using FreeBSD 12.1. -- Doug