From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 06E34384A023 for ; Fri, 12 Mar 2021 11:37:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 06E34384A023 Received: by mail-pg1-x529.google.com with SMTP id x29so15683145pgk.6 for ; Fri, 12 Mar 2021 03:37:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=yMhz7fdezYdztL/5EON0I449WcY+0M7zEfJvMiBvMTw=; b=cuEoKQiAnG0KjY49FaBxlPSzmMtXa2sTzgVeaQ7ak/3nXP8EOvS0o8iqvxx+RszY4O eJsTOydl/IJEibuQOmBSWtg/91KPpHT99QAVehzmOfB05hkdRjjuxSuBYMjvDDvbcfGW dZRjdt2nZwobHeVWfoIaRzu67dKhB4ub4e1ODsCYndylE92K/r/vYDiwrdzIKBwyhhWY +wgkFyVPKUbwU7RxJrNjPmIWchp7tvFTxTeGjselG4zA60YKVK/R4CJ1Z5Y0TqcgKfqn ch1jgDqLi+8BF5OXCsGd7iWVQqjTq5d6qgCegD2EEYN4pNPfnSv+SzHPoKIe5ZMjrpoT J5Yg== X-Gm-Message-State: AOAM530voMvDIiI7eYOhSbeKeLwoSOzsh428nwdBEoh68dm5XgrSmDw6 i3p14SlQHDXCo+JAhz2VVqv7JHeSu0ve+rOVLAWVIMje X-Google-Smtp-Source: ABdhPJwBe6M8gDZtrz4+Yg0LSfnlSO5NUbezlSi5auTPAHh6NAGHkDNf9eQU929mbf9WxEmY2+ub7ilDrk+KXkH9PUs= X-Received: by 2002:a63:4a44:: with SMTP id j4mr11336862pgl.199.1615549056679; Fri, 12 Mar 2021 03:37:36 -0800 (PST) MIME-Version: 1.0 References: <87a6r87il4.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Alessandro Carminati Date: Fri, 12 Mar 2021 12:37:00 +0100 Message-ID: Subject: Fwd: MIPSEL GLIBC sem_init() not shared To: libc-help@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:37:40 -0000 On Fri, Mar 12, 2021 at 11:49 AM Florian Weimer wrote: > > * Alessandro Carminati via Libc-help: > > > But looking at the liba.so dependencies, I've been surprised by the > > fact that the library depends only on the main libc library > > (libc.so.6) and has no dependency on libpthread.so.0 where the actual > > sem_* symbols are implemented. > > > > $ /lib/ld-2.31.so --list /usr/lib/liba.so > > linux-vdso.so.1 (0x7ffaa000) > > libc.so.6 => /lib/libc.so.6 (0x77ddc000) > > /lib/ld-2.31.so (0x77f8a000) > > > > I guess this might be related to my problem, but I have no clue how to > > link these two facts. How the liba.so could be compiled and linked > > using symbols its dependencies do not provide? > > This is called underlinking. It produces invalid objects. > > > How to force the GNU linker to link against sem_init@@GLIBC_2.2 > > instead of sem_init@GLIBC_2.0? > > Just link with -lpthread, it will add the symbol version and call the > right function. > > We are working on changes to glibc that makes it much less likely that > such underlink can happen, so hopefully such difficult-to-debug problems > will become a non-issue at some point in the future. > > Thanks, > Florian > Yes, it was just as you said. Underlinking. My fault. I knew it was related, but I put the -lptread in the wrong place. Thanks for the answer, it resolved the main issue. If I can, I'd like to ask you a couple of questions about the same scenario. This time was the port on MIPSEL, but before this port, I compiled successfully (without -lpthread) on two other architectures: ARM32 and x64. Which is the mechanism why in other architecture, the libpthread was included and in MIPS it didn't? I understand that because the libpthread is a dependency of the executable that also depends on liba.so, at runtime, the dynamic linker has been able to resolve the sem_init call. My question is, why it resolved the call picking the sem_init@GLIBC_2.0 instead of sem_init@@GLIBC_2.2?