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

export -lssp for static libraries #704

Merged
merged 1 commit into from
Jun 13, 2024
Merged

export -lssp for static libraries #704

merged 1 commit into from
Jun 13, 2024

Conversation

robUx4
Copy link
Contributor

@robUx4 robUx4 commented May 22, 2024

.a files in MinGW don't list the other static libraries they depend on. We need to provide it through the pkg-config file.

@ktmf01
Copy link
Collaborator

ktmf01 commented May 22, 2024

Hi,

Thanks for the PR. Seeing the nature of it, I'm curious as to why I haven't had problems without this before. Can you explain a bit what libraries libssp would need?

@robUx4
Copy link
Contributor Author

robUx4 commented May 23, 2024

I also don't understand how it worked before for us. I got this issue when I enable Link Time Optimization (-flto). Then for some reason it required this library to be present to really probe what code is used and what code is not.

@robUx4
Copy link
Contributor Author

robUx4 commented May 24, 2024

More background on how we picked this issue in VLC. We enable stack protection on all code we build. So libssp.a was linked with the DLL using libFLAC. But when enabling LTO libssp.a was not detected properly and not used. Then our DLL using libFLAC wouldn't link anymore because it didn't know it needed libssp.a.

@ktmf01
Copy link
Collaborator

ktmf01 commented Jun 6, 2024

This seems correct for CMake: there the static version of libssp is only used when working with mingw, and therefore the addition to pkg-config is only done for mingw. However, the autotools patch does it for all platforms, not just mingw. Also, in autotools that static linking isn't enfored for mingw either.

Now I'm not really sure what to do. Maybe forcing static linking of libssp is a bad thing altogether. Any ideas?

@robUx4
Copy link
Contributor Author

robUx4 commented Jun 11, 2024

Libs.private is only used when using pkg-config --static so people using a dynamic library version will not be affected, even if you put the wrong value in there.

However for autotools it's true that -lssp will be added even though it's probably not needed and may not even link properly.

.a files in MinGW don't list the other static libraries they depend on.
We need to provide it through the pkg-config file.
@robUx4
Copy link
Contributor Author

robUx4 commented Jun 11, 2024

I removed the autotools variant. XIPH_GCC_STACK_PROTECTOR is actually testing linking works. It will fail because -lssp is not used. To be able to use strong stack protection in this case, this macro needs to be modified and export what linker flags need to be used.

@ktmf01
Copy link
Collaborator

ktmf01 commented Jun 13, 2024

Thanks!

@ktmf01 ktmf01 merged commit a0f6661 into xiph:master Jun 13, 2024
14 checks passed
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.

2 participants