Removing lib libraries for C that do not seem to be used #293
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.
Tested with
app-starknet
that was built and installed locally as:where:
ledger-secure-sdk
corresponds toledger-secure-sdk@API_LEVEL_24
(case-1 - witharch
sub-folder removed for the sake of test, case-2 - with all the files present)ledger-device-rust-sdk
corresponds toledger-device-rust-sdk@remove_libc
(the present branch)app-starknet
case -1 was redirected to the local Rust SDK:and in case-2 that was without changes.
Then I compared the case-1 and case-2 result binaries.
Using
readelf -S starknet/target/flex/release/starknet
:we can see that the sizes of sections almost did not change (as for
.text
section for example), only few sections changed slightly (as for exampleledger.sdk_version
one)Then I compared few functions that make part of libc:
memcmp()
:strlen()
:We see that in the both cases a "compiler_builtins" is used behind, not a function from libc (that explains also why it builds).
Conclusion: the Rust application build does not require the libraries from C SDK.
Just in case I'm attaching the disassembles for the case-1 and case-2:
1.txt
2.txt