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

Explicit assign the symbol visibility #1760

Closed

Conversation

gongminmin
Copy link
Contributor

This modification is based on https://gcc.gnu.org/wiki/Visibility. In this change, export entries are explicitly marked as default visibility. If put -fvisibility=hidden to CXXFLAGS, dxcompiler binary size reduces for ~25%.

This modification is based on https://gcc.gnu.org/wiki/Visibility. In this change, export entries are explicitly marked as default visibility. If put -fvisibility=hidden to CXXFLAGS, dxcompiler binary size reduces for ~25%.
@AppVeyorBot
Copy link

@@ -13,8 +13,18 @@
#ifndef __DXC_API__
#define __DXC_API__

#ifndef DXC_API_IMPORT
#define DXC_API_IMPORT __declspec(dllimport)
#ifdef _WIN32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need compiler-specific switches here? Do all windows compilers support __declspec(dll*) and all non-windows compilers support __attribute__((visibility))?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinGW and clang on Windows also supports __declspec(dll*). So it become a platform thing.

Copy link
Contributor

@tristanlabelle tristanlabelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stated gains are only when using GCC, right?

Copy link
Contributor Author

@gongminmin gongminmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build by both gcc and clang can benefit from this. For gcc, the libdxcompiler.so drops from 28M to 22M. For clang, it's from 27M to 20M. They still larger than build by msvc on Windows, which is 17M.

@@ -13,8 +13,18 @@
#ifndef __DXC_API__
#define __DXC_API__

#ifndef DXC_API_IMPORT
#define DXC_API_IMPORT __declspec(dllimport)
#ifdef _WIN32
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinGW and clang on Windows also supports __declspec(dll*). So it become a platform thing.

@tristanlabelle
Copy link
Contributor

The full change, including changing the default compiler flags to hidden, was merged as part of #2213. So we can close this.

@gongminmin gongminmin deleted the mgong/SymbolVisibility branch May 30, 2019 12:04
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.

None yet

3 participants