Skip to content

compiler: Improve handling of -fno-builtin and compiler-rt options #21920

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

Merged
merged 17 commits into from
Nov 12, 2024

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Nov 5, 2024

Closes #21831.

Note: I don't consider this to supersede #21900. Having a way to apply nobuiltin to individual calls is still useful when you don't want to apply it to an entire module, and is important for us to have feature parity with C compilers.

@ParfenovIgor note that ae69c8c will introduce a small (but easily fixable) merge conflict with your PR since this PR will likely be merged before Andrew gets around to looking at #21833.

Clang only uses the system assembler for nvptx and xcore nowadays.
This option, by its very nature, needs to be attached to a module. If it isn't,
the code in a module could break at random when compiled into an application
that doesn't have this option set.

After this change, skip_linker_dependencies no longer implies no_builtin in the
LLVM backend.
This looks to be a refactoring leftover.
@alexrp alexrp changed the title Improve handling of -fno-builtin and compiler-rt options compiler: Improve handling of -fno-builtin and compiler-rt options Nov 5, 2024
…tion.

From `zig build-exe --help`:

  -fno-builtin              Disable implicit builtin knowledge of functions

It seems entirely reasonable and even expected that this option should imply
both no-builtins on functions (which disables transformation of recognized code
patterns to libcalls) and nobuiltin on call sites (which disables transformation
of libcalls to intrinsics). We now match Clang's behavior for -fno-builtin.

In both cases, we're painting with a fairly broad brush by applying this to an
entire module, but it's better than nothing. ziglang#21833 proposes a more fine-grained
way to apply nobuiltin.
In particular:

* -fms-extensions for MinGW
* -fno-builtin
* -fno-emulated-tls for Android 29+
* -fno-exceptions
* -fomit-frame-pointer
* -fvisibility=hidden
This is already handled by build_crt_file().
…nd-tables.

These are already handled by build_crt_file().
@alexrp alexrp merged commit 1db8cad into ziglang:master Nov 12, 2024
10 checks passed
@alexrp alexrp deleted the nobuiltin branch November 12, 2024 15:40
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.

compiler_rt function __aeabi_memcpy calls itself (ARM/Thumb)
1 participant