-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[ARM][Compiler-RT] Add optional exclusion of libc provided ARM AEABI builtins from compiler-rt. #137952
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth mentioning in the description that libgcc does not define the aeabi functions that align with the C-library functions https://github.com/ARM-software/abi-aa/blob/main/rtabi32/rtabi32.rst#534memory-copying-clearing-and-setting so when this option is enabled then it will make compiler-rt match libgcc.
There is actually no __aeabi_memcmp
function and neither clang or gcc call it. I don't know why compiler-rt defines it. I don't think it is worth removing it, but it does mean that we could exclude it, as it is logically a C-library provided function. I don't think it matters too much either way.
Also worth mentioning that this fixes a duplicate symbol problem when compiler-rt is added before the C-library on the link line, which is the case with the bare-metal driver.
…builtins from compiler-rt. This patch introduces a new optional CMake flag: COMPILER_RT_EXCLUDE_LIBC_PROVIDED_ARM_AEABI_BUILTINS When enabled, this flag excludes the following ARM AEABI memory function implementations from the compiler-rt build: __aeabi_memset __aeabi_memcpy __aeabi_memmove These functions are already provided by standard C libraries like glibc, newlib, and picolibc, so excluding them avoids duplicate symbol definitions and reduces unnecessary code duplication. Note: __aeabi_memcmp and other AEABI functions are not excluded, as they are not defined in all standard libraries. This flag is OFF by default, meaning all AEABI memory builtins will still be built unless explicitly excluded. This change is useful for environments where libc provides runtime routines, supporting more minimal, conflict free builds.
… AEABI builtins from compiler-rt. Add aeabi_memcmp.S to the set of libc-supplied builtins. Refactor the CMake logic upon adding a new optional flag.
3f6c0b2
to
bb4120b
Compare
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. This looks good to me and should avoid a multiply defined symbol error between picolibc and compiler-rt.
Please leave some time for other reviewers to comment before merging.
This patch introduces a new optional CMake flag:
COMPILER_RT_EXCLUDE_LIBC_PROVIDED_ARM_AEABI_BUILTINS
When enabled, this flag excludes the following ARM AEABI memory function implementations from the compiler-rt build:
__aeabi_memcmp
__aeabi_memset
__aeabi_memcpy
__aeabi_memmove
These functions are already provided by standard C libraries like glibc, newlib, and picolibc, so excluding them avoids duplicate symbol definitions and reduces unnecessary code duplication.
Note:
This change is useful for environments where libc provides runtime routines, supporting more minimal, conflict free builds.