Bug 149569

Summary: [patch] rtld(1): runtime linker unable to load needed object with the same name as referencing object [regressio]
Product: Base System Reporter: KT Sin <ktsin>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 8.1-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description KT Sin 2010-08-12 11:00:08 UTC
starting from freebsd 7, the runtime linker is unable to load needed
object having the same name as the referencing object even though the
needed object's rpath is set.

$ ldd ./libclntsh.so.9.0
./libclntsh.so.9.0:
        libclntsh.so.9.0 => ./libclntsh.so.9.0 (0x881a8000)

$ objdump -x ./libclntsh.so.9.0 | head -25

./libclntsh.so.9.0:     file format elf32-i386-freebsd
./libclntsh.so.9.0
architecture: i386, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00002700

Program Header:
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
         filesz 0x00002d20 memsz 0x00002d20 flags r-x
    LOAD off    0x00002d20 vaddr 0x00003d20 paddr 0x00003d20 align 2**12
         filesz 0x000000d8 memsz 0x000000fc flags rw-
 DYNAMIC off    0x00002d68 vaddr 0x00003d68 paddr 0x00003d68 align 2**2
         filesz 0x00000090 memsz 0x00000090 flags rw-
    NOTE off    0x00002d08 vaddr 0x00002d08 paddr 0x00002d08 align 2**2
         filesz 0x00000018 memsz 0x00000018 flags r--

Dynamic Section:
  NEEDED      libclntsh.so.9.0
  SONAME      libclntsh.so.9.0
  RPATH       /usr/local/test/oracle/lib
  INIT        0x26b0
  FINI        0x2d00
  HASH        0xb4
  STRTAB      0x153c

Fix: proposed fix is attached.

after patching rtld.c and rebuilding ld-elf.so.1 :

$ ldd ./libclntsh.so.9.0
./libclntsh.so.9.0:
        libclntsh.so.9.0 => /usr/local/test/oracle/lib/libclntsh.so.9.0 (0x88300000)
        libwtc9.so => /usr/local/lib/libwtc9.so (0x881ac000)
        libm.so.2 => /usr/local/lib/libm.so.2 (0x881ae000)



Patch attached with submission follows:
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:03 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:37:00 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>