Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: adding link time optimization support #385

Merged
merged 1 commit into from
Jun 25, 2022
Merged

build: adding link time optimization support #385

merged 1 commit into from
Jun 25, 2022

Conversation

SuperFola
Copy link
Member

Adding LTO support

Description

Adding IPO/LTO support when building, if the compiler can provide it.

Checklist

  • I have read the Contributor guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation if needed
  • I have added tests that prove my fix/feature is working
  • New and existing tests pass locally with my changes

@SuperFola
Copy link
Member Author

SuperFola commented Jun 22, 2022

I was able to reproduce the segfault of the gcc 8 build by downloading the artifact. Here is the gdb logs

gdb --args ./arkscript ~/code/Ark/tests/arkscript/unittests.ark --lib ./lib
(gdb) r
Starting program: /home/fola/code/ark-debug/ubuntu-gcc8/arkscript /home/fola/code/Ark/tests/arkscript/unittests.ark --lib ./lib
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00005555555bc338 in std::filesystem::__cxx11::path::_M_split_cmpts() ()
(gdb) bt
#0  0x00005555555bc338 in std::filesystem::__cxx11::path::_M_split_cmpts() ()
#1  0x00007ffff7f21a7d in std::filesystem::current_path[abi:cxx11](std::error_code&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00007ffff7f21e1a in std::filesystem::current_path[abi:cxx11]() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff7bafa84 in Ark::Utils::canonicalRelPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from libArkReactor.so
#4  0x00007ffff7bb0048 in Ark::internal::Parser::feed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from libArkReactor.so
#5  0x00007ffff7ba3c81 in Ark::Compiler::feed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from libArkReactor.so
#6  0x00007ffff7b9d6d6 in Ark::State::compile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from libArkReactor.so
#7  0x00007ffff7b9dba3 in Ark::State::doFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from libArkReactor.so
#8  0x000055555556bf85 in main ()

Seems related to https://stackoverflow.com/questions/63902528/program-crashes-when-filesystempath-is-destroyed

@SuperFola SuperFola force-pushed the feat/lto branch 2 times, most recently from dc86f21 to b9cf5ac Compare June 25, 2022 14:47
@SuperFola
Copy link
Member Author

The solution was to disable LTO on GCC 8.

@SuperFola SuperFola merged commit 8866e87 into dev Jun 25, 2022
@SuperFola SuperFola deleted the feat/lto branch June 25, 2022 17:06
rstefanic pushed a commit to rstefanic/Ark that referenced this pull request Dec 24, 2022
build: adding link time optimization support
Former-commit-id: 1d0cbdf8f11f14894b1fb5c49cb7bb8721023499
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant