Garba Peter via llvm-dev
2019-May-23 15:26 UTC
[llvm-dev] Crash with llvm 8.0.0 and -fembed-bitcode option
Hi, I found a bug in llvm 8.0.0. When you compile with the "-fembed-bitcode" option it will lead to a crash when executing the output binary. For unknown reason the assembled x86 code is different when the "-fembed-bitcode" option is supplied. It works with clang 7.0.1 a.cpp: #include <string> #include <iostream> int func(int a); int main(int argc, char **argv) { std::string s = std::to_string(func(argc)); std::cout << s << std::endl; return 0; } b.cpp: int func(int a) { return a+1; } Compile with: => clang++-8 a.cpp b.cpp -fembed-bitcode && ./a.out and it fails: => [1] 14811 segmentation fault (core dumped) ./a.out Compile with: => clang++-8 a.cpp b.cpp && ./a.out and it works: => 2 Best Regards, Peter -- [Thales] Peter Garba Software Security Expert Gemalto is now part of the Thales Group. Please note that my new email address is peter.garba at thalesgroup.com<mailto:peter.garba at thalesgroup.com> THALES Werinherstr. 81 81541 Munich www.thalesgroup.com<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.thalesgroup.com&data=02%7C01%7Cpeter.garba%40gemalto.com%7C6f3ba1b0164240a99de008d6ceea71e0%7C37d0a9db7c464096bfe31add5b495d6d%7C0%7C0%7C636923903659973465&sdata=eldBP%2B%2Ff6Y9qDDywWLI98CGNeZwtG4dOrNYRuUuZEdw%3D&reserved=0> ________________________________ This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited. E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender. Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190523/c674f98b/attachment.html>
Tom Stellard via llvm-dev
2019-May-23 20:04 UTC
[llvm-dev] Crash with llvm 8.0.0 and -fembed-bitcode option
On 05/23/2019 08:26 AM, Garba Peter via llvm-dev wrote:> Hi, > > I found a bug in llvm 8.0.0. > When you compile with the "-fembed-bitcode" option it will lead to a crash when executing the output binary. >Can you file a bug for this at bugs.llvm.org and cc me? -Tom> For unknown reason the assembled x86 code is different when the "-fembed-bitcode" option is supplied. > > It works with clang 7.0.1 > > > a.cpp: > #include <string> > #include <iostream> > > int func(int a); > > int main(int argc, char **argv) { > std::string s = std::to_string(func(argc)); > std::cout << s << std::endl; > return 0; > } > > b.cpp: > int func(int a) { > return a+1; > } > > > Compile with: > > => clang++-8 a.cpp b.cpp -fembed-bitcode && ./a.out > > > and it fails: > > => [1] 14811 segmentation fault (core dumped) ./a.out > > > > Compile with: > > => clang++-8 a.cpp b.cpp && ./a.out > > > and it works: > > => 2 > > > > > Best Regards, > > Peter > > > -- > > > > Thales > > *Peter Garba* > Software Security Expert > > Gemalto is now part of the Thales Group. > Please note that my new email address is peter.garba at thalesgroup.com <mailto:peter.garba at thalesgroup.com> > > > > *THALES* > > Werinherstr. 81 > > 81541 Munich > > www.thalesgroup.com <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.thalesgroup.com&data=02%7C01%7Cpeter.garba%40gemalto.com%7C6f3ba1b0164240a99de008d6ceea71e0%7C37d0a9db7c464096bfe31add5b495d6d%7C0%7C0%7C636923903659973465&sdata=eldBP%2B%2Ff6Y9qDDywWLI98CGNeZwtG4dOrNYRuUuZEdw%3D&reserved=0> > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited. > E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender. > Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus. > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >