From owner-svn-ports-all@FreeBSD.ORG Sun Sep 14 12:19:46 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCFF836C; Sun, 14 Sep 2014 12:19:46 +0000 (UTC) Received: from mail-vc0-x22c.google.com (mail-vc0-x22c.google.com [IPv6:2607:f8b0:400c:c03::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64D1CF39; Sun, 14 Sep 2014 12:19:46 +0000 (UTC) Received: by mail-vc0-f172.google.com with SMTP id hy10so2435737vcb.17 for ; Sun, 14 Sep 2014 05:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=sKnWuf6iHFFAPgHsWf7GLcnrv4bbtDn6+/GSSoObhSc=; b=wQuOac4oElDdnochFx1Eh+YUz2oud+eSPAHitfDQI22AazpAQA0gvk/+KYRvl6ppyX ssYkBRZbL01+ru6rgJUbbzI9idC4dlyJDhH6wZvUT3cQUCbwk/us3fHWyUrsDucu0yDV x1gmJWPY7T8Ys9jYsTPUkDiTsvK7zxSRV2ALDZgofpqWJNDU+ugGaMTtlLTzQ5SvLUpv sMADoFjUQwhPFPl5ecbu4Xbuh6mBLWauWJTf25obCFsWDKc4pO1wVb87V7p/GxgfLcoQ BWEdk6Uk1LOIioJKhMXUa5vGyA4bd/aMljuMHXI02ZZU95CWajQNSPuOY/pDBbKdv/0+ RWcA== MIME-Version: 1.0 X-Received: by 10.52.246.198 with SMTP id xy6mr14714452vdc.7.1410697184565; Sun, 14 Sep 2014 05:19:44 -0700 (PDT) Sender: bsdkaffee@gmail.com Received: by 10.220.153.19 with HTTP; Sun, 14 Sep 2014 05:19:44 -0700 (PDT) In-Reply-To: <20140914112837.375964ab@kalimero.tijl.coosemans.org> References: <201409131920.s8DJKNGP095467@svn.freebsd.org> <20140914112837.375964ab@kalimero.tijl.coosemans.org> Date: Sun, 14 Sep 2014 08:19:44 -0400 X-Google-Sender-Auth: qX70X4qoQcFOANFaEvKpNYsO-y4 Message-ID: Subject: Re: svn commit: r368130 - in head/devel/bennugd-core: . files From: "Jason E. Hale" To: Tijl Coosemans Content-Type: text/plain; charset=UTF-8 Cc: "svn-ports-head@freebsd.org" , "svn-ports-all@freebsd.org" , ports-committers X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Sep 2014 12:19:47 -0000 On Sun, Sep 14, 2014 at 5:28 AM, Tijl Coosemans wrote: > On Sun, 14 Sep 2014 04:20:34 -0400 "Jason E. Hale" wrote: >> >> Should we no longer be patching for -lpthread? Does >> https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/dads-pthread.html >> no longer apply? > > If you ask me it doesn't. The C compiler automatically links in libc > and we used to have two, libc (without threading) and libc_r (with > threading). The -pthread flag told the compiler which one to use. > Nowadays we have one libc and libpthread provides threading functions. > All -pthread does is tell the compiler to link in libpthread, just like > -lpthread does. They are the same. > > It used to be that this libpthread could only be linked into executables > and not into libraries. This meant that if an executable depended on a > library that used threading, it had to be linked with libpthread even if > it didn't use threading itself. This is why several ports still have > LDFLAGS+=-pthread or similar, just because one of the libraries in the > dependency chain used threading. This is no longer necessary. > > There's one thing that is still special about libpthread and that is > that it needs to be loaded into memory before libc because it overrides > some libc symbols. So if you mention -lc explicitly on the command > line (which you normally don't), -lpthread has to appear in front of it. > And, if an executable dlopen()s a library that uses threading, the > executable needs to be linked with libpthread even if it doesn't use > threading itself. Very interesting. Thanks for your detailed response, Tijl!