This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RISC-V glibc port, v5


On Thu, 25 Jan 2018 12:32:36 PST (-0800), joseph@codesourcery.com wrote:
On Thu, 25 Jan 2018, Joseph Myers wrote:

On Wed, 24 Jan 2018, Palmer Dabbelt wrote:

> I believe we've taken into account all the feedback, and are now below 20 test

Still missing an ldd_rewrite_script setting as mentioned as needed for
multi-ABI support in
<https://sourceware.org/ml/libc-alpha/2018-01/msg00008.html> and
<https://sourceware.org/ml/libc-alpha/2018-01/msg00521.html>.

And dl-cache.h is missing a definition of add_system_dir.

When I looked through that I didn't think we needed one because libraries were always in paths defined by the arch/abi pair. Our libraries live in
 */lib64/lp64d
 */lib64/lp64
 */lib

with only ld.so living in */lib (as ld-linux-*.so). Looking through the existing codebases it appears that I'm supposed to be adding all the directories in which we could find libraries for any library path argument add_system_dir is given.

Given my new understanding of what's going on here, I think this should do it

   /* If given a path to one of our library directories, adds every library
      directory via add_dir (), otherwise just adds the giver directory.  On
      RISC-V, libraries can be found in paths ending in:
        - /lib64/lp64d
        - /lib64/lp64
        - /lib (only ld.so)
      so this will add all of those paths.  */
   #define add_system_dir(dir)                                             \
     do                                                                    \
       {                                                                   \
         size_t len = strlen (dir);                                        \
         char path[len + 10];                                              \
         memcpy (path, dir, len + 1);                                      \
         if (len >= 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12))   \
           {                                                               \
             len -= 8;                                                     \
             path[len] = '\0';                                             \
           }                                                               \
         if (len >= 11 && ! memcmp(path + len - 11, "/lib64/lp64", 11))    \
           {                                                               \
             len -= 7;                                                     \
             path[len] = '\0';                                             \
           }                                                               \
         add_dir (path);                                                   \
         if (len >= 4 && ! memcmp(path + len - 4, "/lib", 4))              \
           {                                                               \
             memcpy (path + len, "64/lp64d", 10);                          \
             add_dir (path);                                               \
             memcpy (path + len, "64/lp64", 9);                            \
             add_dir (path);                                               \
           }                                                               \
       } while (0)

I'll include this in our v6.

Thanks!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]