Message ID | fcdfbb3d91bfd861336b1cb2a1d0fea343fbad0d.1543572707.git.zongbox@gmail.com |
---|---|
State | New |
Headers | show |
Series | RISC-V glibc port for the 32-bit | expand |
DJ Delorie <dj@redhat.com> 於 2018年12月8日 週六 上午6:18寫道: > > > As much as I hate code duplication, I think we need separate macros for > 64 and 32 bit targets, else the 32-bit linker will search 64-bit > libraries and the 64-bit linker will search 32-bit libraries. While the > linker should be smart enough to skip incompatible libraries, it's > expensive to do so, and certainly "unexpected" from a developer's point > of view. Make sense. It should be separated for rv32 and rv64. > Zong Li <zongbox@gmail.com> writes: > > @@ -51,7 +53,14 @@ > > size_t len = strlen (dir); \ > > char path[len + 9]; \ > > memcpy (path, dir, len + 1); \ > > - if (len >= 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12)) \ > > + if (len >= 13 && ! memcmp(path + len - 13, "/lib32/ilp32d", 13)) \ > > + { \ > > + len -= 9; \ > > + path[len] = '\0'; \ > > + } \ > > + if (len >= 12 \ > > + && (! memcmp(path + len - 12, "/lib32/ilp32", 12) \ > > + || ! memcmp(path + len - 12, "/lib64/lp64d", 12))) \ > > { \ > > len -= 8; \ > > path[len] = '\0'; \ > > @@ -64,6 +73,10 @@ > > add_dir (path); \ > > if (len >= 4 && ! memcmp(path + len - 4, "/lib", 4)) \ > > { \ > > + memcpy (path + len, "32/ilp32d", 10); \ > > + add_dir (path); \ > > + memcpy (path + len, "32/ilp32", 9); \ > > + add_dir (path); \ > > memcpy (path + len, "64/lp64d", 9); \ > > add_dir (path); \ > > memcpy (path + len, "64/lp64", 8); \
diff --git a/ChangeLog b/ChangeLog index a50a024..8986cd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2018-11-29 Zong Li <zong@andestech.com> * sysdeps/unix/sysv/linux/riscv/ldconfig.h (LD_SO_ABI): Support rv32. + * sysdeps/unix/sysv/linux/riscv/dl-cache.h (add_system_dir): Add + libraries path for rv32. 2018-11-28 Florian Weimer <fweimer@redhat.com> diff --git a/sysdeps/unix/sysv/linux/riscv/dl-cache.h b/sysdeps/unix/sysv/linux/riscv/dl-cache.h index cbd6ef5..f3a999a 100644 --- a/sysdeps/unix/sysv/linux/riscv/dl-cache.h +++ b/sysdeps/unix/sysv/linux/riscv/dl-cache.h @@ -34,6 +34,8 @@ RISC-V, libraries can be found in paths ending in: - /lib64/lp64d - /lib64/lp64 + - /lib32/ilp32d + - /lib32/ilp32 - /lib (only ld.so) so this will add all of those paths. @@ -51,7 +53,14 @@ size_t len = strlen (dir); \ char path[len + 9]; \ memcpy (path, dir, len + 1); \ - if (len >= 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12)) \ + if (len >= 13 && ! memcmp(path + len - 13, "/lib32/ilp32d", 13)) \ + { \ + len -= 9; \ + path[len] = '\0'; \ + } \ + if (len >= 12 \ + && (! memcmp(path + len - 12, "/lib32/ilp32", 12) \ + || ! memcmp(path + len - 12, "/lib64/lp64d", 12))) \ { \ len -= 8; \ path[len] = '\0'; \ @@ -64,6 +73,10 @@ add_dir (path); \ if (len >= 4 && ! memcmp(path + len - 4, "/lib", 4)) \ { \ + memcpy (path + len, "32/ilp32d", 10); \ + add_dir (path); \ + memcpy (path + len, "32/ilp32", 9); \ + add_dir (path); \ memcpy (path + len, "64/lp64d", 9); \ add_dir (path); \ memcpy (path + len, "64/lp64", 8); \