Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable weak symbol support for Risc-V? #4069

Closed
guoyuqi020 opened this issue Jun 6, 2024 · 2 comments
Closed

Enable weak symbol support for Risc-V? #4069

guoyuqi020 opened this issue Jun 6, 2024 · 2 comments

Comments

@guoyuqi020
Copy link

I am using zstd on Risc-V machines. I noticed that zstd_trace is disabled on Risc-V. After some investigating, I found this was because the zstd's weak symbol support was conservatively disabled on Risc-V.

However, as far as I know, Risc-V supports weak symbols, and the weak attribute can be used on Risc-V’s GCC.

So, will you consider enabling weak symbol support for Risc-V?

I guess adding a defined (__riscv) in the following code will make it work.

// lib/common/zstd_trace.h

/* weak symbol support
 * For now, enable conservatively:
 * - Only GNUC
 * - Only ELF
 * - Only x86-64, i386 and aarch64
 * Also, explicitly disable on platforms known not to work so they aren't
 * forgotten in the future.
 */
#if !defined(ZSTD_HAVE_WEAK_SYMBOLS) && \
    defined(__GNUC__) && defined(__ELF__) && \
    (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) || defined(__aarch64__)) && \
    !defined(__APPLE__) && !defined(_WIN32) && !defined(__MINGW32__) && \
    !defined(__CYGWIN__) && !defined(_AIX)
#  define ZSTD_HAVE_WEAK_SYMBOLS 1
#else
#  define ZSTD_HAVE_WEAK_SYMBOLS 0
#endif
#if ZSTD_HAVE_WEAK_SYMBOLS
#  define ZSTD_WEAK_ATTR __attribute__((__weak__))
#else
#  define ZSTD_WEAK_ATTR
#endif
@adenilsoncavalcanti
Copy link

I can help with this one, I got access to RVV 1.0 compliant RISC-V boards to test.

Adenilson pushed a commit to Adenilson/zstd that referenced this issue Aug 6, 2024
Both gcc and clang support weak symbols on RISC-V, therefore
let's enable it.

This should fix issue facebook#4069.
@guoyuqi020
Copy link
Author

Seems this has been solved. Now I close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants