[LLVMbugs] [Bug 12478] New: Clang pass wrong library paths if used with --sysroot

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 6 04:23:34 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12478

             Bug #: 12478
           Summary: Clang pass wrong library paths if used with --sysroot
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: glotov at chromium.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


When Clang is passed --sysroot=/build/x86-alex/, the resulting call to the
linker has the following library paths (in order):

-L/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.6.x-google 
-L/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.6.x-google/../../../../lib64 
-L/build/x86-alex//lib/../lib64 
-L/build/x86-alex//usr/lib/../lib64 
-L/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.6.x-google/../../../../x86_64-pc-linux-gnu/lib 
-L/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.6.x-google/../../.. 
-L/build/x86-alex//lib 
-L/build/x86-alex//usr/lib

Note that /usr/lib64 (2nd path) is prior to /build/x86-alex/usr/lib64 (3rd
path).

As the result, the linker picks wrong DSO (if both root and sysroot have
same-named DSO) and may makes resulting image unusable.

repro: clang hello_world.cc --sysroot=/any/existing/path -v; note -L order

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list