bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/24449] New: Gold linker doesn't work as expected with indirect


From: amitarya2187 at gmail dot com
Subject: [Bug gold/24449] New: Gold linker doesn't work as expected with indirectly linked libraries with rpath.
Date: Thu, 11 Apr 2019 23:06:02 +0000

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

            Bug ID: 24449
           Summary: Gold linker doesn't work as expected with indirectly
                    linked libraries with rpath.
           Product: binutils
           Version: 2.25
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: amitarya2187 at gmail dot com
                CC: ian at airs dot com
  Target Milestone: ---

Gold linker doesn't seeem to respect rpath for indirectly linked libraries. I 
use
rpath to link against libraries found in crosstool.

So building a file main.cpp looks like the following.

BUILD
======
/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-g++
\
        -o dns \
       
-B/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin.gold
\
       
-Wl,--dynamic-linker=/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/lib/ld-linux-x86-64.so.2
\
       
-Wl,-rpath=/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/lib
\
        main.cpp \

Filtering libnss* and libresolv.so in strace.
==============================================
% strace -e open ./main |& grep -E "nss.*so|resolv.*so" | grep -v "= -1"        
open("/lib64/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnss_mdns4_minimal.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnss_myhostname.so.2", O_RDONLY|O_CLOEXEC) = 3

Meanwhile with standard linker.
===============================

% strace -e open ./dns |& grep -E "nss.*so|resolv.*so" | grep -v "= -1"
open("/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/lib/libnss_files.so.2",
O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libnss_mdns4_minimal.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/lib/libnss_dns.so.2",
O_RDONLY|O_CLOEXEC) = 3
open("/usr/local/scaligent/toolchain/crosstool/v4/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/lib/libresolv.so.2",
O_RDONLY|O_CLOEXEC) = 3

The problem is resolved when I provided "-lnss_files -lnss_dns -lresolv" in the
build command, but this behavior seems confusing.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]