From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by sourceware.org (Postfix) with ESMTPS id 21B3D3858D37 for ; Mon, 17 Aug 2020 02:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 21B3D3858D37 Received: by mail-vs1-xe2c.google.com with SMTP id a1so7499223vsp.4 for ; Sun, 16 Aug 2020 19:15:39 -0700 (PDT) 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:cc; bh=PE1vxpYvaYzZOR3eKxh1Tfp10Zgr1APPmPD7rVI3J6k=; b=CUFjhsAXHviInJtFqb5TIYH+LLGZCxkkmbPWT6NI99EYnjBWuflkYNznddJITwNoWq mwTZn1jz/P5sl3SAq/rcAuSH614qcq7xCWHYdgCxP5+oBiAG8R5FydriZ38Jbn6eYjpS kf+hMJRCERuDw3cm6P5oMzX8j0XpaimM2sv5HrKQp5Bs65UCp3CrZBek099PRrLjCkV+ viu7qXZEwSRCIy9ks9Ie0hz9kzrRBcuFfKgskCZd82xAl8bLuOTttRu4JCIXn/uWkpia +VJ99Flt7jCLw1uWQC5nAtuJztxBnYmCKeW5ADx08ZTcS/VN2ySmlwnC/8pl9QiPUhGA X59g== X-Gm-Message-State: AOAM530QA1gyz4HDK4sUlKzbkpF+Kyq1CN4kWRA25vCQW8dg26ETa5HC tkZMCMCdfp6NNnv6US8Aolb95w9Z+9ZosG/9GiDa5QU3Rl8= X-Google-Smtp-Source: ABdhPJx3h3e3hktuSTDBb5vbKzvrpZcDbpcBSE55IVeZwc6T6nkVBRvmiDRZD0To6Zk76I2mJAOuCln+Sp/R004qPyU= X-Received: by 2002:a67:2ec8:: with SMTP id u191mr7279862vsu.131.1597630538654; Sun, 16 Aug 2020 19:15:38 -0700 (PDT) MIME-Version: 1.0 References: <87y2meiw6g.fsf@mid.deneb.enyo.de> In-Reply-To: <87y2meiw6g.fsf@mid.deneb.enyo.de> From: "Y.D." Date: Mon, 17 Aug 2020 10:15:28 +0800 Message-ID: Subject: Re: Add a new function to dlfcn.h? To: Florian Weimer Cc: libc-help@sourceware.org X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Mon, 17 Aug 2020 02:15:40 -0000 Hi Florian, Thanks for your quick reply! Now I've created a new file called dl-usage.c under elf/. And I've added dl-usage to routines in Makefile under elf/, just in case, I've added it to dl-routines, too. But when I create a new file, including dlfcn.h and refer to the function, the error message is "undefined reference to `dlusage' collect2: error: ld returned 1 exit status". I can make sure that: I've declared the function in dlfcn/dlfcn.h and implemented it in elf/dl-usage.c There are dl-usage.o, dl-usage.os files under build/elf I use the modified version of dynamic library by "-Wl, -rpath=3D" command Can you tell me where the problem is? Sorry I didn't cc the list last time. Fengkai Florian Weimer =E4=BA=8E2020=E5=B9=B48=E6=9C=8816=E6=97= =A5=E5=91=A8=E6=97=A5 =E4=B8=8B=E5=8D=888:59=E5=86=99=E9=81=93=EF=BC=9A > * Y. D. via Libc-help: > > > The question is, when I want to imitate the way dlopen works, I find th= at > > the dlopen first calls functions in dlfcn/dlopen.c, and then functions = in > > elf/dl-open.c, which makes me very confused. > > If I want to add a new function in dlfcn.h, what should I do? > > New dynamic linker functions should probably go into libc.so.6, and > implemented under elf/. > > There is not much value in maintaining a separate libdl (but it's less > problematic than libpthread). I expect that libdl will eventually go > away. >