public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* ldconfig is statically linked or dynamiclly linked
@ 2022-09-01  9:41 Lv Ying
  2022-09-01 12:19 ` Florian Weimer
  2022-09-01 12:22 ` Siddhesh Poyarekar
  0 siblings, 2 replies; 4+ messages in thread
From: Lv Ying @ 2022-09-01  9:41 UTC (permalink / raw)
  To: libc-help

Hi all:

    I am confused when exec file ldconfig and ldd ldconfig on CentOS 8(glibc-2.28):

# which ldconfig
/usr/sbin/ldconfig
# file /usr/sbin/ldconfig
/usr/sbin/ldconfig: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, for GNU/Linux 3.2.0, BuildID[sha1]=90ddd9a3e194fb2ec4edd5184d9fca4df45af636, not stripped
# ldd /usr/sbin/ldconfig
    statically linked


So ldconfig is dynamiclly linked or statically linked?


I lookup elf/Makefile:

ifeq (yes,$(use-ldconfig))
ifeq (yes,$(build-shared))
others-static   += ldconfig
others          += ldconfig
install-rootsbin += ldconfig


I think ldconfig may be statically linked, and can ldconfig be only statically linked?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ldconfig is statically linked or dynamiclly linked
  2022-09-01  9:41 ldconfig is statically linked or dynamiclly linked Lv Ying
@ 2022-09-01 12:19 ` Florian Weimer
  2022-09-01 12:22 ` Siddhesh Poyarekar
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2022-09-01 12:19 UTC (permalink / raw)
  To: Lv Ying via Libc-help; +Cc: Lv Ying

* Lv Ying via Libc-help:

> So ldconfig is dynamiclly linked or statically linked?

Usually, glibc ldconfig is statically linked.  The output of the file
tool is notoriously unreliable.

> I think ldconfig may be statically linked, and can ldconfig be only
> statically linked?

It's technically possible to link it dynamically, with a few makefile
changes, but we don't do that, to make it easier to recover from certain
failure scenarios.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ldconfig is statically linked or dynamiclly linked
  2022-09-01  9:41 ldconfig is statically linked or dynamiclly linked Lv Ying
  2022-09-01 12:19 ` Florian Weimer
@ 2022-09-01 12:22 ` Siddhesh Poyarekar
  2022-09-01 13:15   ` Adhemerval Zanella Netto
  1 sibling, 1 reply; 4+ messages in thread
From: Siddhesh Poyarekar @ 2022-09-01 12:22 UTC (permalink / raw)
  To: Lv Ying; +Cc: libc-help

On Thu, Sep 1, 2022 at 5:42 AM Lv Ying via Libc-help
<libc-help@sourceware.org> wrote:
>     I am confused when exec file ldconfig and ldd ldconfig on CentOS 8(glibc-2.28):
>
> # which ldconfig
> /usr/sbin/ldconfig
> # file /usr/sbin/ldconfig
> /usr/sbin/ldconfig: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, for GNU/Linux 3.2.0, BuildID[sha1]=90ddd9a3e194fb2ec4edd5184d9fca4df45af636, not stripped

ldconfig is a statically linked PIE executable.  The file command
tends to claim that PIE executables are shared objects, which is what
you're seeing here.

Sid

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ldconfig is statically linked or dynamiclly linked
  2022-09-01 12:22 ` Siddhesh Poyarekar
@ 2022-09-01 13:15   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella Netto @ 2022-09-01 13:15 UTC (permalink / raw)
  To: Siddhesh Poyarekar, Lv Ying; +Cc: libc-help



On 01/09/22 09:22, Siddhesh Poyarekar via Libc-help wrote:
> On Thu, Sep 1, 2022 at 5:42 AM Lv Ying via Libc-help
> <libc-help@sourceware.org> wrote:
>>     I am confused when exec file ldconfig and ldd ldconfig on CentOS 8(glibc-2.28):
>>
>> # which ldconfig
>> /usr/sbin/ldconfig
>> # file /usr/sbin/ldconfig
>> /usr/sbin/ldconfig: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, for GNU/Linux 3.2.0, BuildID[sha1]=90ddd9a3e194fb2ec4edd5184d9fca4df45af636, not stripped
> 
> ldconfig is a statically linked PIE executable.  The file command
> tends to claim that PIE executables are shared objects, which is what
> you're seeing here.
> 
> Sid

I think the issue is the file command, using a more recent one it does show
that ldconfig is a static-pie:

$ file elf/ldconfig
elf/ldconfig: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), 
static-pie linked, for GNU/Linux 3.2.0, with debug_info, not stripped

$ readelf -l elf/ldconfig  | grep INTERP
$

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-01 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01  9:41 ldconfig is statically linked or dynamiclly linked Lv Ying
2022-09-01 12:19 ` Florian Weimer
2022-09-01 12:22 ` Siddhesh Poyarekar
2022-09-01 13:15   ` Adhemerval Zanella Netto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).