Skip to content

[compiler-rt] Allow using a compiler without stdio and printf #95234

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

Closed
wants to merge 1 commit into from

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Jun 12, 2024

Summary:
Part of attempts to get compiler-rt working for NVPTX and AMDGPU
targets. We only wish to build the builtins, which are unhosted.
Currently the build system rejects any compiler that isn't hosted due to
the check requiring printf. SImply make it return zero instead.

Summary:
Part of attempts to get `compiler-rt` working for NVPTX and AMDGPU
targets. We only wish to build the builtins, which are unhosted.
Currently the build system rejects any compiler that isn't hosted due to
the check requiring `printf`. SImply make it return zero instead.
@@ -223,7 +223,7 @@ set(COMPILER_RT_SUPPORTED_ARCH)
# runtime libraries supported by our current compilers cross-compiling
# abilities.
set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main(void) { printf(\"hello, world\"); }\n")
file(WRITE ${SIMPLE_SOURCE} "#include <stdint.h>\nint main(void) { return 0; }\n")
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be fine to leave as is? The builtins set TEST_COMPILE_ONLY which will use:

#include <limits.h>
int foo(int x, int y) { return x + y; }

as the test code rather than this, which is still useful for the non-builtins code in the repository.

Could you share more about how this is problematic when building just the builtins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, I have a cache with the failure but after nuking the directory I don't get it anymore. It might've been stuck from a previous run and didn't get cleared properly after updating something else. Sorry about that.

After some other hacks I think I've gotten it to at least pass configuring, building only creates files for a few of the floating point values. This seems to be far off the "generic sources" list I see.

extendbfsf2.c.o
truncdfbf2.c.o
truncsfbf2.c.o

I can go ahead and close this since it doesn't seem to be necessary for the parts I'm interested in.

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

Successfully merging this pull request may close these issues.

3 participants