Conversation
Add more symbols from LLVM's list of libcalls to the list of non-LTO files in libc. Sadly it quite hard to write robust tests for this kind of thing as it depends on LLVM internals. Fixes #16836
kripken
left a comment
There was a problem hiding this comment.
Side note, I guess this is another benefit of Binaryen's LTO-like opts since some of these functions might be small and worth inlining...
| 'fputc.c', | ||
| 'fgets.c', | ||
| 'putc.c', 'putc_unlocked.c', | ||
| 'putchar.c', 'putchar_unlocked.c', |
There was a problem hiding this comment.
Do I understand things right that files are put here when LLVM might emit them in LTO ops? That is, there is some LTO opt that could emit a call to getc() that did not exist before.
If so, might it be worth mentioning the source of such calls, like which LLVM pass does so? That might help us prune this list in the future. But if it's hard to do, it doesn't matter I suppose.
There was a problem hiding this comment.
Yes exactly. Don't you think the existing extensive comment above is enough? It gets in to the specifics of llvm's libcall mechanism. Perhaps I can link to specific upstream files and passes though.
There was a problem hiding this comment.
The existing comment is probably enough for now. I guess if we need to find the specific LLVM passes that create these calls then we could search in the source.
There was a problem hiding this comment.
Maybe another option (instead of forcing these files to never be bitcode) is to compile both bitcode and native versions. The bitcode versions get linked into LTO as usual, but then we can add native versions to the native link, which would get pulled in if they weren't in the original link?
There was a problem hiding this comment.
That would require some kind of clever linker change though... as of today that linker always finds the first version of a given symbol and ignores all others.
There was a problem hiding this comment.
Another way of putting that would require the answer to the question "where is putc defined" to have a different answer before and after LTO.
|
|
||
| # Check for missing file in non_lto_files list. Do this here | ||
| # rather than in the constructor so it only happens when the | ||
| # library is actually built (not when its instantiated). |
There was a problem hiding this comment.
| # library is actually built (not when its instantiated). | |
| # library is actually built (not when it's instantiated). |
Add more symbols from LLVM's list of libcalls to the list of non-LTO
files in libc.
Sadly it quite hard to write robust tests for this kind of thing as it
depends on LLVM internals.
Fixes #16836