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

Fix missing symbols when using aot mode on riscv platforms. (#3731) #3812

Merged

Conversation

Kvencc
Copy link
Contributor

@Kvencc Kvencc commented Sep 24, 2024

Fix missing symbols when using AOT mode on RISCV platforms.

If the target platform does not support the “Atomic Instructions” or “Integer Multiplication and Division” features, or does not turn on support for these CPU features when using wamrc to compile the aot file.

Just add these two macros when compiling iwasm:

  • ARCH_RISCV_COMPILE_AOT_WITHOUT_FEATURE_A=1
  • ARCH_RISCV_COMPILE_AOT_WITHOUT_FEATURE_M=1

@Kvencc Kvencc force-pushed the fix_riscv32_without_cpu_features branch from 0ab8cf7 to ff90f27 Compare September 24, 2024 06:23
@no1wudi
Copy link
Collaborator

no1wudi commented Sep 25, 2024

Could you please describe the specific use case?

In my view, if the purpose is to detect whether atomic or multiplication/division instructions are supported, one can use the built-in macros in GCC to identify this without the need for additional configurations.

@Kvencc
Copy link
Contributor Author

Kvencc commented Sep 25, 2024

Yes, you have a point. The current processing really isn't necessary.
In that case, it seems like just adding the missing atomic operation symbols and __floatdisf.

Is this a good way to handle it?

@no1wudi
Copy link
Collaborator

no1wudi commented Sep 25, 2024

Is this a good way to handle it?

Yes, I think something like __riscv_atomic is enough to handle it

@@ -101,6 +106,8 @@ void __umoddi3(void);
void __umodsi3(void);
void __unorddf2(void);
void __unordsf2(void);
void __atomic_compare_exchange_4(void);
void __atomic_store_4(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build_iwasm_on_nuttx CI reported errors:
image
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/11052682397/job/30739828374

How about changing to below lines to have a try:

bool __atomic_compare_exchange_4(volatile void *, void *, unsigned int,
                                 bool, int, int);
void __atomic_store_4(volatile void *, unsigned int, int);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll try it.

@wenyongh wenyongh merged commit 438b81b into bytecodealliance:main Sep 28, 2024
383 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants