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

Cross-language LTO #25

Open
efenniht opened this issue Aug 16, 2019 · 0 comments
Open

Cross-language LTO #25

efenniht opened this issue Aug 16, 2019 · 0 comments

Comments

@efenniht
Copy link
Collaborator

현재 Rust와 C 코드 사이에는 LTO가 작동하지 않고 있습니다. C FFI 함수들에다가 #[inline] 어트리뷰트를 붙이면 컴파일이 제대로 안 되는 데 이것이 원인입니다. #21 을 해결하는 도중에 쓸데없는 오버헤드가 있는 getter를 너무 많이 만들어서, 이것을 해결하려다가 알게 되었습니다.

Rust에서는 이 문제를 해결하기 위해서 -Clinker-plugin-lto 라는 옵션이 있습니다. 하지만 이 옵션은 정말 써먹기 어렵습니다. 삽질의 과정을 기록해 둡니다:

  • 처음에는 이 옵션의 outdated 된 이름을 사용하려다가 안 되어서 당황했고,
  • 이 옵션만 사용하면 오류가 납니다. -Clinker-plugin-lto doesn't work without extra manual work rust-lang/rust#60059 참고.
  • 그래서 이 이슈대로 링커 플러그인을 사용하도록 지정하면, rust의 링커 버전과 prebuilts 아래의 링커 버전이 달라서 컴파일이 안 됩니다. (x.y.z 의 z 부분이 차이나는데 이러는군요!)

Rust backend를 다 prebuilts에 있는 clang을 사용하도록 바꾸면 될 것 같긴 한데 그렇게 쓸모있을 것 같진 않습니다. 사실 컴파일 타임이 너무 길어져서 지금은 당장 필요하지 않네요. 아무튼 인라이닝을 안하는 이유에 대한 문서만 남겨두는 걸로...

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

No branches or pull requests

1 participant