-
-
Notifications
You must be signed in to change notification settings - Fork 15.6k
The compiled output of type cdylib became larger. #150364
Copy link
Copy link
Open
Labels
A-lldArea: Linkage issues specific to rust-lldArea: Linkage issues specific to rust-lldC-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-lldArea: Linkage issues specific to rust-lldArea: Linkage issues specific to rust-lldC-bugCategory: This is a bug.Category: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
I wrote a small test as follow.
First, I wrote an upstream C static library and compiled it into an object file.
Then I created a cdylib project downstream.
Cargo.toml
src/lib.rs
When I compiled using
1.85.0-x86_64-unknown-linux-gnu, the size oflibdownstream_cdylib.sowas17KB; when I compiled using1.87.0-x86_64-unknown-linux-gnu, the size oflibdownstream_cdylib.sowas still17KB; however, when I compiled using1.90.0-x86_64-unknown-linux-gnu, the size oflibdownstream_cdylib.sobecame396KB.Compilation command for above all was
cargo +1.**.0-x86_64-unknown-linux-gnu rustc --release -- -C link-arg=c_add.o.Specifically, in
1.87, runnm -D target/release/libdownstream_cdylib.so, we can see:w __cxa_finalize@GLIBC_2.2.5 0000000000001100 T downstream_add w __gmon_start__ w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTableHowever, in
1.90, we can see:U abort@GLIBC_2.2.5 U bcmp@GLIBC_2.2.5 U calloc@GLIBC_2.2.5 U close@GLIBC_2.2.5 w __cxa_finalize@GLIBC_2.2.5 w __cxa_thread_atexit_impl@GLIBC_2.18 U dl_iterate_phdr@GLIBC_2.2.5 00000000000128a0 T downstream_add U __errno_location@GLIBC_2.2.5 U free@GLIBC_2.2.5 U fstat64@GLIBC_2.33 U getcwd@GLIBC_2.2.5 U getenv@GLIBC_2.2.5 w __gmon_start__ w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable U lseek64@GLIBC_2.2.5 U malloc@GLIBC_2.2.5 U memcpy@GLIBC_2.14 U memmove@GLIBC_2.2.5 U memset@GLIBC_2.2.5 U mmap64@GLIBC_2.2.5 U munmap@GLIBC_2.2.5 U open64@GLIBC_2.2.5 U posix_memalign@GLIBC_2.2.5 U pthread_key_create@GLIBC_2.34 U pthread_key_delete@GLIBC_2.34 U pthread_setspecific@GLIBC_2.34 U read@GLIBC_2.2.5 U readlink@GLIBC_2.2.5 U realloc@GLIBC_2.2.5 U realpath@GLIBC_2.3 U stat64@GLIBC_2.33 w statx@GLIBC_2.28 U strlen@GLIBC_2.2.5 U syscall@GLIBC_2.2.5 U __tls_get_addr@GLIBC_2.3 U _Unwind_Backtrace@GCC_3.3 U _Unwind_GetDataRelBase@GCC_3.0 U _Unwind_GetIP@GCC_3.0 U _Unwind_GetIPInfo@GCC_4.2.0 U _Unwind_GetLanguageSpecificData@GCC_3.0 U _Unwind_GetRegionStart@GCC_3.0 U _Unwind_GetTextRelBase@GCC_3.0 U _Unwind_RaiseException@GCC_3.0 U _Unwind_Resume@GCC_3.0 U _Unwind_SetGR@GCC_3.0 U _Unwind_SetIP@GCC_3.0 U write@GLIBC_2.2.5 U writev@GLIBC_2.2.5I want to know what features were added in the new version that caused this increase in binary size?