public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/27977] New: Unexpected behavior when using DT_FILTER
@ 2021-06-10 10:16 tdiff at yandex dot ru
  2021-06-11 10:17 ` [Bug dynamic-link/27977] " tdiff at yandex dot ru
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tdiff at yandex dot ru @ 2021-06-10 10:16 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 27977
           Summary: Unexpected behavior when using DT_FILTER
           Product: glibc
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: tdiff at yandex dot ru
  Target Milestone: ---

Created attachment 13489
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13489&action=edit
Problem repro

Hi,

I am trying to use DT_FILTER to hide conflicting symbol implementation from one
of two libraries linked into the main executable.

In the attached example I have following setup:
lib1.so: func1(), func2()
lib2.so: func1(), func3()
lib2f.so: func3() //< this is a filter for lib2.so
main(): calls func1(), func2(), func3().

lib2f.so and lib1.so are passed to ld in the following order:
  gcc main.c -L. -l2f -l1 -o $@

Expected:
main calls func1() from lib1.so

Actual:
main calls func1() from lib2.so

Reasoning:
>From man ld:
       -F name
       --filter=name
           ... 
           If you later link a program against this filter object, then,
           when you run the program, the dynamic linker will see the
           DT_FILTER field.  The dynamic linker will resolve symbols
           according to the symbol table of the filter object as usual,
           but it will actually link to the definitions found in the
           shared object name. Thus the filter object can be used to
           select a subset of the symbols provided by the object name.

This clearly refers to runtime linker and mentions that dynsym of filter.so
should be used for symbol lookup. However, it looks like runtime liker does not
respect filter object.

I observe same behavior on glibc 1.17 @ Suse and 1.34 @ Ubuntu so looks like it
is not a distro-specific issue.

-- 
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-11-13 10:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 10:16 [Bug dynamic-link/27977] New: Unexpected behavior when using DT_FILTER tdiff at yandex dot ru
2021-06-11 10:17 ` [Bug dynamic-link/27977] " tdiff at yandex dot ru
2021-06-16 15:39 ` alex.ameen.tx at gmail dot com
2021-06-18 15:48 ` fweimer at redhat dot com
2021-06-19 20:28 ` tdiff at yandex dot ru
2021-06-19 20:43 ` alex.ameen.tx at gmail dot com
2021-06-19 20:44 ` alex.ameen.tx at gmail dot com
2021-06-28  9:33 ` fweimer at redhat dot com
2021-06-28 18:37 ` tdiff at yandex dot ru
2023-11-13 10:25 ` sam at gentoo dot org

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