carray(1) is a tiny but flexible Sortix program that turns a binary file into a C file <https://sortix.org/man/man1/carray.1.html …> <https://gitlab.com/sortix/sortix/blob/master/carray/carray.c …> $ echo foo > bar $ carray bar unsigned char bar[] = { 0x66, 0x6F, 0x6F, 0x0A, };
I should say huge initializer list rather than single string-literal initializer. It's an array either way.
-
-
So the problem is objcopy hiding the content from the compiler? Why? What about LTO? Why does it matter for a big static array? Which optimizations do you expect?
-
Re: hiding, yes. I already mentioned static analysis & value range based optimization.
-
Dumb example: if it's a bitrot table and your rotate operation is safe against out-of-range values, by seeing the table contents are all in-range the compiler can optimize out the range reduction.
-
I don't see how this kind of table would be generated from a binary file. Also, can probably be still done with LTO. Or maybe I didn't get the example.
-
LTO doesn't work at that level (only on compiler's LTO IR) and there are fundamental difficulties trying to make it work on that level. See this thread:https://twitter.com/RichFelker/status/1009284296216141825 …
-
I agree it's a dumb example, but you can imagine examples where the data is something like signed values that are all positive or that never achieve the minimum value (which is pathological in some ways).
-
I agree that LTO can't work on compiled code in general, but we're taking here on a static char array. LTO'ing that should be at at least possible.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.