Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Is it normal that fastcomp on linux takes ~6GB? #6

Closed
trzecieu opened this issue Dec 7, 2015 · 3 comments
Closed

Is it normal that fastcomp on linux takes ~6GB? #6

trzecieu opened this issue Dec 7, 2015 · 3 comments

Comments

@trzecieu
Copy link

trzecieu commented Dec 7, 2015

Hi, I'm trying to prepare a Docker image with Emscripten (based on Ubuntu 15.10) and it works fine except image size what is huge. Major chunk of image is consumed by clang. There is an output.

root@98096b18fc46:/emsdk_portable/clang/tag-e1.35.0/build_tag-e1.35.0_32/bin# ls -laSh && du -sh
total 4.6G
-rwxr-xr-x  1 root root 833M Dec  2 16:23 clang-3.7
-rwxr-xr-x  1 root root 415M Dec  2 16:23 clang-check
-rwxr-xr-x  1 root root 339M Dec  2 16:24 opt
-rwxr-xr-x  1 root root 307M Dec  2 16:22 arcmt-test
-rwxr-xr-x  1 root root 278M Dec  2 16:21 llvm-lto
-rwxr-xr-x  1 root root 264M Dec  2 16:17 diagtool
-rwxr-xr-x  1 root root 233M Dec  2 16:20 lli
-rwxr-xr-x  1 root root 230M Dec  2 16:24 llc
-rwxr-xr-x  1 root root 218M Dec  2 16:21 llvm-dsymutil
-rwxr-xr-x  1 root root 216M Dec  2 16:21 bugpoint
-rwxr-xr-x  1 root root 202M Dec  2 16:21 llvm-c-test
-rwxr-xr-x  1 root root 100M Dec  2 16:20 llvm-objdump
-rwxr-xr-x  1 root root  95M Dec  2 16:23 llvm-mc
-rwxr-xr-x  1 root root  92M Dec  2 16:24 llvm-nm
-rwxr-xr-x  1 root root  92M Dec  2 16:24 llvm-ar
-rwxr-xr-x  1 root root  56M Dec  2 16:21 llvm-rtdyld
-rwxr-xr-x  1 root root  49M Dec  2 16:20 llvm-extract
-rwxr-xr-x  1 root root  43M Dec  2 16:17 llvm-cov
-rwxr-xr-x  1 root root  42M Dec  2 16:17 llvm-symbolizer
-rwxr-xr-x  1 root root  42M Dec  2 16:20 llvm-link
-rwxr-xr-x  1 root root  42M Dec  2 16:21 llvm-readobj
-rwxr-xr-x  1 root root  41M Dec  2 16:21 verify-uselistorder
-rwxr-xr-x  1 root root  41M Dec  2 16:17 obj2yaml
-rwxr-xr-x  1 root root  40M Dec  2 16:17 llvm-dwarfdump
-rwxr-xr-x  1 root root  39M Dec  2 16:21 llvm-cxxdump
-rwxr-xr-x  1 root root  38M Dec  2 16:16 llvm-size
-rwxr-xr-x  1 root root  38M Dec  2 16:17 macho-dump
-rwxr-xr-x  1 root root  37M Dec  2 16:20 llvm-diff
-rwxr-xr-x  1 root root  36M Dec  2 16:16 llvm-as
-rwxr-xr-x  1 root root  36M Dec  2 15:55 llvm-tblgen
-rwxr-xr-x  1 root root  32M Dec  2 16:20 llvm-dis
-rwxr-xr-x  1 root root  30M Dec  2 16:21 llvm-stress
-rwxr-xr-x  1 root root  30M Dec  2 16:17 clang-format
-rwxr-xr-x  1 root root  24M Dec  2 16:17 llvm-profdata
-rwxr-xr-x  1 root root  13M Dec  2 15:55 clang-tblgen
-rwxr-xr-x  1 root root 7.7M Dec  2 16:17 yaml2obj
-rwxr-xr-x  1 root root 7.2M Dec  2 15:54 llvm-pdbdump
-rwxr-xr-x  1 root root 5.0M Dec  2 15:54 yaml-bench
-rwxr-xr-x  1 root root 4.8M Dec  2 15:54 FileCheck
-rwxr-xr-x  1 root root 4.6M Dec  2 16:17 llvm-bcanalyzer
-rwxr-xr-x  1 root root 4.1M Dec  2 15:54 llvm-mcmarkup
-rwxr-xr-x  1 root root 2.7M Dec  2 15:54 llvm-config
-rwxr-xr-x  1 root root 2.2M Dec  2 15:54 lli-child-target
-rwxr-xr-x  1 root root 2.1M Dec  2 15:54 not
-rwxr-xr-x  1 root root 324K Dec  2 16:24 c-index-test
-rwxr-xr-x  1 root root 101K Dec  2 15:54 llvm-PerfectShuffle
-rwxr-xr-x  1 root root  22K Dec  2 16:24 c-arcmt-test
-rwxr-xr-x  1 root root  14K Dec  2 15:54 count
drwxr-xr-x  2 root root 4.0K Dec  2 16:24 .
drwxr-xr-x 16 root root 4.0K Dec  7 08:55 ..
-rwxrwxr-x  1 root root 1.7K Dec  2 15:52 llvm-lit
lrwxrwxrwx  1 root root    9 Dec  2 16:23 clang -> clang-3.7
lrwxrwxrwx  1 root root    7 Dec  2 16:24 llvm-ranlib -> llvm-ar
lrwxrwxrwx  1 root root    5 Dec  2 16:23 clang++ -> clang
lrwxrwxrwx  1 root root    5 Dec  2 16:23 clang-cl -> clang

Question is: Can we do something with compilation flags that in default it will produce size optimized clang binary files?

@juj
Copy link
Collaborator

juj commented Dec 7, 2015

I am guessing that the generated executables have debugging symbols preserved in them. If you installed the incoming branch, it builds the RelWithDebInfo target by default. Try cleaning and rebuilding Release target instead, which won't have debugging symbols:

./emsdk uninstall sdk-incoming-64bit
./emsdk install --build=Release sdk-incoming-64bit

Does that help?

@trzecieu
Copy link
Author

trzecieu commented Dec 7, 2015

Thank you a lot @juj! Indeed it works much better

root@d30f270a3a7f:/emsdk_portable/clang/tag-e1.35.0/build_tag-e1.35.0_32/bin# ls -laSh
total 246M
-rwxr-xr-x  1 root root  44M Dec  7 18:45 clang-3.7
-rwxr-xr-x  1 root root  21M Dec  7 18:45 opt
-rwxr-xr-x  1 root root  18M Dec  7 18:41 clang-check
-rwxr-xr-x  1 root root  17M Dec  7 18:45 llc
-rwxr-xr-x  1 root root  16M Dec  7 18:45 lli
-rwxr-xr-x  1 root root  16M Dec  7 18:45 llvm-lto
-rwxr-xr-x  1 root root  15M Dec  7 18:40 arcmt-test
-rwxr-xr-x  1 root root  14M Dec  7 18:45 llvm-c-test
-rwxr-xr-x  1 root root  13M Dec  7 18:45 llvm-dsymutil
-rwxr-xr-x  1 root root  12M Dec  7 18:43 bugpoint
-rwxr-xr-x  1 root root 6.1M Dec  7 18:45 llvm-objdump
-rwxr-xr-x  1 root root 4.4M Dec  7 18:45 llvm-mc
-rwxr-xr-x  1 root root 4.3M Dec  7 18:45 llvm-nm
-rwxr-xr-x  1 root root 4.3M Dec  7 18:45 llvm-ar
-rwxr-xr-x  1 root root 4.0M Dec  7 18:45 llvm-rtdyld
-rwxr-xr-x  1 root root 2.7M Dec  7 18:40 diagtool
-rwxr-xr-x  1 root root 2.7M Dec  7 18:40 llvm-stress
-rwxr-xr-x  1 root root 2.4M Dec  7 18:45 llvm-readobj
-rwxr-xr-x  1 root root 2.3M Dec  7 18:39 llvm-link
-rwxr-xr-x  1 root root 2.3M Dec  7 18:40 llvm-symbolizer
-rwxr-xr-x  1 root root 2.3M Dec  7 18:40 llvm-cov
-rwxr-xr-x  1 root root 2.3M Dec  7 18:40 verify-uselistorder
-rwxr-xr-x  1 root root 2.2M Dec  7 18:39 llvm-extract
-rwxr-xr-x  1 root root 2.2M Dec  7 18:40 obj2yaml
-rwxr-xr-x  1 root root 2.1M Dec  7 18:39 llvm-size
-rwxr-xr-x  1 root root 2.1M Dec  7 18:45 llvm-cxxdump
-rwxr-xr-x  1 root root 2.0M Dec  7 18:39 llvm-as
-rwxr-xr-x  1 root root 2.0M Dec  7 18:11 llvm-tblgen
-rwxr-xr-x  1 root root 2.0M Dec  7 18:39 macho-dump
-rwxr-xr-x  1 root root 1.9M Dec  7 18:40 llvm-diff
-rwxr-xr-x  1 root root 1.7M Dec  7 18:39 llvm-dis
-rwxr-xr-x  1 root root 1.6M Dec  7 18:40 clang-format
-rwxr-xr-x  1 root root 894K Dec  7 18:10 clang-tblgen
-rwxr-xr-x  1 root root 735K Dec  7 18:39 llvm-profdata
-rwxr-xr-x  1 root root 660K Dec  7 18:39 llvm-dwarfdump
-rwxr-xr-x  1 root root 524K Dec  7 18:40 yaml2obj
-rwxr-xr-x  1 root root 365K Dec  7 18:10 llvm-pdbdump
-rwxr-xr-x  1 root root 320K Dec  7 18:10 FileCheck
-rwxr-xr-x  1 root root 257K Dec  7 18:40 llvm-bcanalyzer
-rwxr-xr-x  1 root root 251K Dec  7 18:10 yaml-bench
-rwxr-xr-x  1 root root 213K Dec  7 18:10 llvm-mcmarkup
-rwxr-xr-x  1 root root 123K Dec  7 18:43 c-index-test
-rwxr-xr-x  1 root root  99K Dec  7 18:10 llvm-config
-rwxr-xr-x  1 root root  62K Dec  7 18:10 not
-rwxr-xr-x  1 root root  45K Dec  7 18:10 lli-child-target
-rwxr-xr-x  1 root root  28K Dec  7 18:10 llvm-PerfectShuffle
-rwxr-xr-x  1 root root  14K Dec  7 18:44 c-arcmt-test
-rwxr-xr-x  1 root root  13K Dec  7 18:10 count
drwxr-xr-x  2 root root 4.0K Dec  7 18:45 .
drwxr-xr-x 16 root root 4.0K Dec  7 18:46 ..
-rwxrwxr-x  1 root root 1.7K Dec  7 18:07 llvm-lit
lrwxrwxrwx  1 root root    9 Dec  7 18:45 clang -> clang-3.7
lrwxrwxrwx  1 root root    7 Dec  7 18:45 llvm-ranlib -> llvm-ar
lrwxrwxrwx  1 root root    5 Dec  7 18:45 clang++ -> clang
lrwxrwxrwx  1 root root    5 Dec  7 18:45 clang-cl -> clang

What do you think about make this flag a default one for installing SDK from a tag? This is a only one way to get Emscripten on Linux and it is too bad this is hidden.

@trzecieu
Copy link
Author

trzecieu commented Dec 7, 2015

I'm closing this as this is not an issue anymore.

@trzecieu trzecieu closed this as completed Dec 7, 2015
kripken pushed a commit that referenced this issue Mar 15, 2017
…ase ctor in window. Need add "complete object flag" check in eh cleanup code.

The problem only happen on window ( A MS-ABI issuer )

The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor.

The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup.

clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor.
But that part is missing for cleanup code.

To fix this add similar code as v-base init to cleanup code, same algorithm.

1> Add new routine:
EmitDtorCompleteObjectHandler

With corresponding to EmitCtorCompleteObjectHandler

2> In the EmitDestructorCal
Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor.

Just add check for "complete object flag" before call to v-base dtor.

Without my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

cleanupret from %13 unwind to caller, !dbg !66

with my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
%is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66
br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d

bg !66

Dtor.dtor_vbase: ; preds = %ehcleanup

call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

br label %Dtor.skip_vbase, !dbg !66

Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup

cleanupret from %13 unwind to caller, !dbg !66

Please let me know you need more info.

Patch by Jennifer Yu.

Differential Revision: https://reviews.llvm.org/D27358



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288869 91177308-0d34-0410-b5e6-96231b3b80d8
juj pushed a commit that referenced this issue Jan 31, 2018
Summary:
The test being added in this patch used to cause an assertion failure:

/build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp
--
Exit Code: 134

Command Output (stderr):
--
clang: /src/tools/clang/lib/AST/ASTDiagnostic.cpp:424: void clang::FormatASTNodeDiagnosticArgument(DiagnosticsEngine::ArgumentKind, intptr_t, llvm::StringRef, llvm::StringRef, ArrayRef<DiagnosticsEngine::ArgumentValue>, SmallVectorImpl<char> &, void *, ArrayRef<intptr_t>): Assertion `isa<NamedDecl>(DC) && "Expected a NamedDecl"' failed.
#0 0x0000000001c7a1b4 PrintStackTraceSignalHandler(void*) (/build/./bin/clang+0x1c7a1b4)
#1 0x0000000001c7a4e6 SignalHandler(int) (/build/./bin/clang+0x1c7a4e6)
#2 0x00007f30880078d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#3 0x00007f3087054067 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35067)
#4 0x00007f3087055448 abort (/lib/x86_64-linux-gnu/libc.so.6+0x36448)
#5 0x00007f308704d266 (/lib/x86_64-linux-gnu/libc.so.6+0x2e266)
#6 0x00007f308704d312 (/lib/x86_64-linux-gnu/libc.so.6+0x2e312)
#7 0x00000000035b7f22 clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long> >, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) (/build/
./bin/clang+0x35b7f22)
#8 0x0000000001ddbae4 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/build/./bin/clang+0x1ddbae4)
#9 0x0000000001ddb323 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/build/./bin/clang+0x1ddb323)
#10 0x00000000022878a4 clang::TextDiagnosticBuffer::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/build/./bin/clang+0x22878a4)
#11 0x0000000001ddf387 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/build/./bin/clang+0x1ddf387)
#12 0x0000000001dd9dea clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/build/./bin/clang+0x1dd9dea)
#13 0x0000000002cad00c clang::Sema::EmitCurrentDiagnostic(unsigned int) (/build/./bin/clang+0x2cad00c)
#14 0x0000000002d91cd2 clang::Sema::CheckShadow(clang::NamedDecl*, clang::NamedDecl*, clang::LookupResult const&) (/build/./bin/clang+0x2d91cd2)

Stack dump:
0.      Program arguments: /build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp
1.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:214:23: current parser token ';'
2.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:213:26: parsing function body 'handleLinkageSpec'
3.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:213:26: in compound statement ('{}')
/build/tools/clang/test/SemaCXX/Output/warn-shadow.cpp.script: line 1: 15595 Aborted                 (core dumped) /build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: krytarowski, cfe-commits

Differential Revision: https://reviews.llvm.org/D33207

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303325 91177308-0d34-0410-b5e6-96231b3b80d8
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants