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

Workaround for compiling firefox with LTO #297

Closed
12101111 opened this issue Feb 21, 2020 · 3 comments
Closed

Workaround for compiling firefox with LTO #297

12101111 opened this issue Feb 21, 2020 · 3 comments

Comments

@12101111
Copy link

I have managed to compile firefox with lto.
screenshot-2020-02-21-08-56-59

The keypoint is compile clang and lld with more stack size.
As documents from musl say, The default stack size on musl is 80KB, while glibc gives a much more big stack (2MB -10MB).
So stack overflow happend when link libxul.so
The default stack size of a program can be set on link time use -Wl,-z,stack-size=N or use binary patch tool: https://github.com/yaegashi/muslstack.
Upstream report: llvm/llvm-project#75

@12101111
Copy link
Author

图片
PGO also works, but have some issues about sandbox:

F: open_wr
S: deny
P: /dev/dri/renderD128
A: /dev/dri/renderD128
R: /dev/dri/renderD128
C: /tmp/portage/www-client/firefox-73.0/work/firefox-73.0/ff/instrumented/dist/firefox/firefox
data:text/html,<script>Quitter.quit()</script> -profile /tmp/portage/www-client/firefox-73.0/te
mp/tmpS0xOPm

F: open_wr
S: deny
P: /dev/dri/card0
A: /dev/dri/card0
R: /dev/dri/card0
C: /tmp/portage/www-client/firefox-73.0/work/firefox-73.0/ff/instrumented/dist/firefox/firefox
data:text/html,<script>Quitter.quit()</script> -profile /tmp/portage/www-client/firefox-73.0/te
mp/tmpS0xOPm

F: open_wr
S: deny
P: /dev/dri/renderD128
A: /dev/dri/renderD128
R: /dev/dri/renderD128
C: /tmp/portage/www-client/firefox-73.0/work/firefox-73.0/ff/instrumented/dist/firefox/firefox http://localhost:8888/index.html -profile /tmp/portage/www-client/firefox-73.0/temp/tmpS0xOPm

F: open_wr
S: deny
P: /dev/dri/card0
A: /dev/dri/card0
R: /dev/dri/card0
C: /tmp/portage/www-client/firefox-73.0/work/firefox-73.0/ff/instrumented/dist/firefox/firefox http://localhost:8888/index.html -profile /tmp/portage/www-client/firefox-73.0/temp/tmpS0xOPm

And some changes in ebuild to get it work:

@@ -263,6 +275,13 @@
 	# Allow user to apply any additional patches without modifing ebuild
 	eapply_user

+	# prebuilt glibc binary files cause python2.7 segfault on musl
+	if use elibc_musl; then
+		rm "${S}"/third_party/python/psutil/psutil/*.so
+		rm "${S}"/third_party/python/psutil/build/lib.linux-x86_64-2.7/psutil/*.so
+		rm "${S}"/third_party/python/psutil/build/temp.linux-x86_64-2.7/psutil/*.o
+	fi
+
 	# Enable gnomebreakpad
 	if use debug ; then
 		sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \

@anarchpenguin
Copy link

I have added an lld and binutils ebuild to my dev overlay, this sets the stacksize to 2MB which means both gcc and clang can build firefox/thunderbird with lto enabled. I have updated 76.0_beta4 ebuild also in my devspace with the changes you have submitted here, so pgo will work as well. I am working with toolchain project to try and get them to add binutils change to tree, if they do not will add to musl overlay. Thanks for the work you have done to help improve the mozilla packages for musl users.

@anarchpenguin
Copy link

binutils/lld testing versions are in overlay. I will get stable ebuilds added to overlay in a day or so.

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

2 participants