Add -fno-builtin command line flag#5081
Merged
kinke merged 8 commits intoldc-developers:masterfrom Mar 9, 2026
Merged
Conversation
82e1465 to
b22ee17
Compare
Contributor
thewilsonator
left a comment
There was a problem hiding this comment.
also why the changes phobos?
kinke
reviewed
Mar 8, 2026
kinke
reviewed
Mar 8, 2026
f4c69da to
203d3a7
Compare
kinke
reviewed
Mar 8, 2026
tests/codegen/attr_fno_builtin.d
Outdated
| extern(C) int printf(const char*, ...); | ||
|
|
||
| extern(C) void test_builtin() { | ||
| printf("hi reviewer\n"); |
Member
There was a problem hiding this comment.
I suggest using something like https://cpp.godbolt.org/z/bGPzjrxe3 - with -fno-builtin, LDC shouldn't optimize a memcpy call etc. with -O. [And please add a trailing newline for the file, see the diff here on GitHub.]
Contributor
Author
There was a problem hiding this comment.
Thanks for you suggetions!
I added a trailing newline, please take a look ^^
Contributor
Author
There was a problem hiding this comment.
i built and tested my code locally with `-fno-builtin` flag and it works the same as your example
@kinke
Member
There was a problem hiding this comment.
I meant changing the test so that it tests something useful, e.g., breaking as soon as LLVM changes the string.
Contributor
Author
|
@kinke, please leave a review, thank you! |
kinke
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
-fno-builtinflagThis PR implements the
-fno-builtinflag to disable implicit knowledge of built-in functions, as requested in #3263.Changes:
-fno-builtinto command-line options."no-built-in"attribute to LLVM functions in codegen.tests/codegen/attr_fno_builtin.d.Fixes part of #3263.