From owner-freebsd-hackers@freebsd.org Sat Dec 26 12:52:49 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7590A523A5 for ; Sat, 26 Dec 2015 12:52:49 +0000 (UTC) (envelope-from radovanovic@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5657C1FF2 for ; Sat, 26 Dec 2015 12:52:49 +0000 (UTC) (envelope-from radovanovic@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id p187so220346802wmp.1 for ; Sat, 26 Dec 2015 04:52:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=VKR1anGUxG/NGegyPLrFxOE5U8owICqsPDEos0rsKl8=; b=kNnrXB1phTdcLOgfl1tiC8LBhFWIN6m6Lh+pbwVcewHsKLCRxuOnAVeSWC4rrClYYV 0wDN+r1tqpK1wJ0BoJnru6jE6DFzByJjKGJ8N3z0QHdugRtkH4FerTPwJas7xEvBeXNt jDEdFnMtXBXEvf26ohpmMoRPrwlEgXUb74YY0ASZrFUWrZEISTHjSLobeofL+sSMOOhm +Zt9Vq7bmumH3xNyq7XA9oJtuSFFQlQYgiBjY8zDu5hnSIu3weLqR6eAICaif3kIMwkQ K1SmXfoCErgcNn5c6BZda0K/rRmiHThXKXsV9Q7UuKy3zqmXBvEFdhf1SnARdC1upfIC Ot6g== X-Received: by 10.28.188.70 with SMTP id m67mr39303586wmf.24.1451134367330; Sat, 26 Dec 2015 04:52:47 -0800 (PST) Received: from zmaj.softwarehood.com (178-221-115-29.dynamic.isp.telekom.rs. [178.221.115.29]) by smtp.googlemail.com with ESMTPSA id qm9sm48858889wjc.39.2015.12.26.04.52.46 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 26 Dec 2015 04:52:46 -0800 (PST) Message-ID: <567E8D9D.6080808@gmail.com> Date: Sat, 26 Dec 2015 13:52:45 +0100 From: Ivan Radovanovic User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130812 Thunderbird/17.0.8 MIME-Version: 1.0 To: Konstantin Belousov CC: freebsd-hackers@freebsd.org Subject: Re: Unexpected behavior of dynamic linker References: <567E810C.3040809@gmail.com> <20151226122818.GI3625@kib.kiev.ua> In-Reply-To: <20151226122818.GI3625@kib.kiev.ua> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Dec 2015 12:52:49 -0000 On 12/26/15 13:28, Konstantin Belousov napisa: > > This is expected behaviour, it is mandated by the ELF standard. ELF > tried to emulate the behaviour of the static libraries as much as possible. > Think what would happen in your case if both modules where linked statically > into the binary. > > To augment the behaviour, read about linker option -Bsymbolic, compiler > option -fhidden, and GNU-specific attribute __visibility__("hidden"). > Thanks for pointer about attributes (it does work as expected if I add __attribute__((visibility("hidden"))) to private classes). This behavior still looks counter-intuitive to me - like linker is resolving already resolved reference, however problem is solved. Thanks!