public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/30256] New: ldd says "statically linked" when its not
@ 2023-03-21  8:27 stsp at users dot sourceforge.net
  2023-03-21  9:19 ` [Bug dynamic-link/30256] " schwab@linux-m68k.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2023-03-21  8:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

            Bug ID: 30256
           Summary: ldd says "statically linked" when its not
           Product: glibc
           Version: 2.36
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: stsp at users dot sourceforge.net
  Target Milestone: ---

Use any dummy source:

void foo(void) {}


Then do:
$ cc -Wall -o libmain.so main.c -shared
$ ldd libmain.so 
        statically linked
$ file libmain.so 
libmain.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, BuildID[sha1]=29a7d60ebcdb6cfae41bc1628c52a8bfc0a65e8f, not stripped


So obviously "file" provides more precise
info than ldd, which mistakenly says the
binary is statically linked when its not.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
@ 2023-03-21  9:19 ` schwab@linux-m68k.org
  2023-03-21  9:45 ` stsp at users dot sourceforge.net
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2023-03-21  9:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
What does objdump -p say?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
  2023-03-21  9:19 ` [Bug dynamic-link/30256] " schwab@linux-m68k.org
@ 2023-03-21  9:45 ` stsp at users dot sourceforge.net
  2023-03-21 10:07 ` schwab@linux-m68k.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2023-03-21  9:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #2 from Stas Sergeev <stsp at users dot sourceforge.net> ---
libmain.so:     file format elf64-x86-64

Program Header:
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**12
         filesz 0x00000000000004b0 memsz 0x00000000000004b0 flags r--
    LOAD off    0x0000000000001000 vaddr 0x0000000000001000 paddr
0x0000000000001000 align 2**12
         filesz 0x0000000000000111 memsz 0x0000000000000111 flags r-x
    LOAD off    0x0000000000002000 vaddr 0x0000000000002000 paddr
0x0000000000002000 align 2**12
         filesz 0x00000000000000a4 memsz 0x00000000000000a4 flags r--
    LOAD off    0x0000000000002e68 vaddr 0x0000000000003e68 paddr
0x0000000000003e68 align 2**12
         filesz 0x00000000000001a0 memsz 0x00000000000001a8 flags rw-
 DYNAMIC off    0x0000000000002e78 vaddr 0x0000000000003e78 paddr
0x0000000000003e78 align 2**3
         filesz 0x0000000000000150 memsz 0x0000000000000150 flags rw-
    NOTE off    0x00000000000002a8 vaddr 0x00000000000002a8 paddr
0x00000000000002a8 align 2**3
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
    NOTE off    0x00000000000002c8 vaddr 0x00000000000002c8 paddr
0x00000000000002c8 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
0x6474e553 off    0x00000000000002a8 vaddr 0x00000000000002a8 paddr
0x00000000000002a8 align 2**3
         filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
EH_FRAME off    0x0000000000002000 vaddr 0x0000000000002000 paddr
0x0000000000002000 align 2**2
         filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x0000000000002e68 vaddr 0x0000000000003e68 paddr
0x0000000000003e68 align 2**0
         filesz 0x0000000000000198 memsz 0x0000000000000198 flags r--

Dynamic Section:
  INIT                 0x0000000000001000
  FINI                 0x0000000000001104
  INIT_ARRAY           0x0000000000003e68
  INIT_ARRAYSZ         0x0000000000000008
  FINI_ARRAY           0x0000000000003e70
  FINI_ARRAYSZ         0x0000000000000008
  GNU_HASH             0x00000000000002f0
  STRTAB               0x00000000000003a8
  SYMTAB               0x0000000000000318
  STRSZ                0x0000000000000059
  SYMENT               0x0000000000000018
  PLTGOT               0x0000000000003fe8
  RELA                 0x0000000000000408
  RELASZ               0x00000000000000a8
  RELAENT              0x0000000000000018
  RELACOUNT            0x0000000000000003

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
  2023-03-21  9:19 ` [Bug dynamic-link/30256] " schwab@linux-m68k.org
  2023-03-21  9:45 ` stsp at users dot sourceforge.net
@ 2023-03-21 10:07 ` schwab@linux-m68k.org
  2023-03-21 11:26 ` stsp at users dot sourceforge.net
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2023-03-21 10:07 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
There is no interpreter and dynamic dependency, which is the definition of a
static object.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2023-03-21 10:07 ` schwab@linux-m68k.org
@ 2023-03-21 11:26 ` stsp at users dot sourceforge.net
  2023-03-21 11:56 ` schwab@linux-m68k.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2023-03-21 11:26 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #4 from Stas Sergeev <stsp at users dot sourceforge.net> ---
So do you mean there is no way to detect if
the -static option was used, but to look if
there are no DT_NEEDED deps? No any flag or
dynamic-specific elf section?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2023-03-21 11:26 ` stsp at users dot sourceforge.net
@ 2023-03-21 11:56 ` schwab@linux-m68k.org
  2023-03-21 12:15 ` stsp at users dot sourceforge.net
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2023-03-21 11:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
Just use the appropriate tool.  ldd is not it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
                   ` (4 preceding siblings ...)
  2023-03-21 11:56 ` schwab@linux-m68k.org
@ 2023-03-21 12:15 ` stsp at users dot sourceforge.net
  2023-03-21 12:59 ` stsp at users dot sourceforge.net
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2023-03-21 12:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #6 from Stas Sergeev <stsp at users dot sourceforge.net> ---
Which tool do you mean?

Maybe in case of a solib you just
need to print "no deps" instead of
"statically linked"?
That looks more correct for the
shared lib that was never statically
linked.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
                   ` (5 preceding siblings ...)
  2023-03-21 12:15 ` stsp at users dot sourceforge.net
@ 2023-03-21 12:59 ` stsp at users dot sourceforge.net
  2023-03-21 13:24 ` schwab@linux-m68k.org
  2023-03-21 15:09 ` stsp at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2023-03-21 12:59 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #7 from Stas Sergeev <stsp at users dot sourceforge.net> ---
I mean, I reported this only to
make an amend to ldd. I don't need
any tool in that particular case.
So if the amend to ldd will not be
done, you can just close this.
OTOH the amend may be to just alter
the message in case of a solib.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
                   ` (6 preceding siblings ...)
  2023-03-21 12:59 ` stsp at users dot sourceforge.net
@ 2023-03-21 13:24 ` schwab@linux-m68k.org
  2023-03-21 15:09 ` stsp at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2023-03-21 13:24 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #8 from Andreas Schwab <schwab@linux-m68k.org> ---
That will break scripts that depend on the output.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug dynamic-link/30256] ldd says "statically linked" when its not
  2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
                   ` (7 preceding siblings ...)
  2023-03-21 13:24 ` schwab@linux-m68k.org
@ 2023-03-21 15:09 ` stsp at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: stsp at users dot sourceforge.net @ 2023-03-21 15:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30256

--- Comment #9 from Stas Sergeev <stsp at users dot sourceforge.net> ---
I didn't mean change globally,
but only for solib w/o deps.
Since in that case the message
was printed by mistake, its hard
to believe some script depended
on non-static lib being reported
as static.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-03-21 15:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21  8:27 [Bug dynamic-link/30256] New: ldd says "statically linked" when its not stsp at users dot sourceforge.net
2023-03-21  9:19 ` [Bug dynamic-link/30256] " schwab@linux-m68k.org
2023-03-21  9:45 ` stsp at users dot sourceforge.net
2023-03-21 10:07 ` schwab@linux-m68k.org
2023-03-21 11:26 ` stsp at users dot sourceforge.net
2023-03-21 11:56 ` schwab@linux-m68k.org
2023-03-21 12:15 ` stsp at users dot sourceforge.net
2023-03-21 12:59 ` stsp at users dot sourceforge.net
2023-03-21 13:24 ` schwab@linux-m68k.org
2023-03-21 15:09 ` stsp at users dot sourceforge.net

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).