From f52eb787369c4266d4e6cfcad4cba631c6098f10 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 8 Jul 2020 23:41:33 +0100 Subject: [PATCH] carla-plugin: Only export exactly the symbols that we need Signed-off-by: falkTX --- source/plugin/Makefile | 44 +++++++++---------- source/plugin/carla-vst-export.cpp | 17 ++++--- .../{win-def => symbols}/carla-lv2_dsp+ui.def | 0 source/plugin/symbols/carla-lv2_dsp+ui.txt | 2 + .../plugin/symbols/carla-lv2_dsp+ui.version | 4 ++ .../{win-def => symbols}/carla-lv2_dsp.def | 0 source/plugin/symbols/carla-lv2_dsp.txt | 1 + source/plugin/symbols/carla-lv2_dsp.version | 4 ++ .../{win-def => symbols}/carla-lv2_ui.def | 0 source/plugin/symbols/carla-lv2_ui.txt | 1 + source/plugin/symbols/carla-lv2_ui.version | 4 ++ .../carla-native-plugin.def | 0 source/plugin/symbols/carla-native-plugin.txt | 10 +++++ .../symbols/carla-native-plugin.version | 13 ++++++ .../plugin/{win-def => symbols}/carla-vst.def | 0 source/plugin/symbols/carla-vst.txt | 1 + source/plugin/symbols/carla-vst.version | 4 ++ 17 files changed, 77 insertions(+), 28 deletions(-) rename source/plugin/{win-def => symbols}/carla-lv2_dsp+ui.def (100%) create mode 100644 source/plugin/symbols/carla-lv2_dsp+ui.txt create mode 100644 source/plugin/symbols/carla-lv2_dsp+ui.version rename source/plugin/{win-def => symbols}/carla-lv2_dsp.def (100%) create mode 100644 source/plugin/symbols/carla-lv2_dsp.txt create mode 100644 source/plugin/symbols/carla-lv2_dsp.version rename source/plugin/{win-def => symbols}/carla-lv2_ui.def (100%) create mode 100644 source/plugin/symbols/carla-lv2_ui.txt create mode 100644 source/plugin/symbols/carla-lv2_ui.version rename source/plugin/{win-def => symbols}/carla-native-plugin.def (100%) create mode 100644 source/plugin/symbols/carla-native-plugin.txt create mode 100644 source/plugin/symbols/carla-native-plugin.version rename source/plugin/{win-def => symbols}/carla-vst.def (100%) create mode 100644 source/plugin/symbols/carla-vst.txt create mode 100644 source/plugin/symbols/carla-vst.version diff --git a/source/plugin/Makefile b/source/plugin/Makefile index 3e903c76e..46ce70acb 100644 --- a/source/plugin/Makefile +++ b/source/plugin/Makefile @@ -121,35 +121,33 @@ LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS) endif endif -ifeq ($(MACOS),true) -SYMBOLS_NATIVE = -Wl,-exported_symbol,_carla_get_native_rack_plugin -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay_plugin -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay16_plugin -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay32_plugin -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay64_plugin -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay_cv_plugin -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_create_native_plugin_host_handle -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_host_handle_free -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_plugin_engine -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_library_filename -SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_library_folder -SYMBOLS_LV2 = -Wl,-exported_symbol,_lv2_descriptor +ifeq ($(WIN32),true) +SYMBOLS_NATIVE = symbols/carla-native-plugin.def +SYMBOLS_VST = symbols/carla-vst.def ifeq ($(HAVE_PYQT),true) -SYMBOLS_LV2 += -Wl,-exported_symbol,_lv2ui_descriptor -SYMBOLS_LV2_UI = -Wl,-exported_symbol,_lv2ui_descriptor +SYMBOLS_LV2 = symbols/carla-lv2_dsp+ui.def +SYMBOLS_LV2_UI = symbols/carla-lv2_ui.def +else +SYMBOLS_LV2 = symbols/carla-lv2_dsp.def endif -SYMBOLS_VST = -Wl,-exported_symbol,_VSTPluginMain +else ifeq ($(MACOS),true) +SYMBOLS_NATIVE = -Wl,-export-symbols=symbols/carla-native-plugin.txt +SYMBOLS_VST = -Wl,-export-symbols=symbols/carla-vst.txt +ifeq ($(HAVE_PYQT),true) +SYMBOLS_LV2 = -Wl,-export-symbols=symbols/carla-lv2_dsp+ui.txt +SYMBOLS_LV2_UI = -Wl,-export-symbols=symbols/carla-lv2_ui.txt +else +SYMBOLS_LV2 = -Wl,-export-symbols=symbols/carla-lv2_dsp.txt endif - -ifeq ($(WIN32),true) -SYMBOLS_NATIVE = win-def/carla-native-plugin.def +else +SYMBOLS_NATIVE = -Wl,--version-script=symbols/carla-native-plugin.version +SYMBOLS_VST = -Wl,--version-script=symbols/carla-vst.version ifeq ($(HAVE_PYQT),true) -SYMBOLS_LV2 = win-def/carla-lv2_dsp+ui.def -SYMBOLS_LV2_UI = win-def/carla-lv2_ui.def +SYMBOLS_LV2 = -Wl,--version-script=symbols/carla-lv2_dsp+ui.version +SYMBOLS_LV2_UI = -Wl,--version-script=symbols/carla-lv2_ui.version else -SYMBOLS_LV2 = win-def/carla-lv2_dsp.def +SYMBOLS_LV2 = -Wl,--version-script=symbols/carla-lv2_dsp.version endif -SYMBOLS_VST = win-def/carla-vst.def endif # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/plugin/carla-vst-export.cpp b/source/plugin/carla-vst-export.cpp index 95a56d3c3..ee72c9f29 100644 --- a/source/plugin/carla-vst-export.cpp +++ b/source/plugin/carla-vst-export.cpp @@ -1,6 +1,6 @@ /* * Carla Native Plugins - * Copyright (C) 2013-2019 Filipe Coelho + * Copyright (C) 2013-2020 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -50,11 +50,7 @@ __cdecl static void cvst_processReplacingCallback(AEffect* effect, float** input #endif CARLA_EXPORT __cdecl -#if defined(CARLA_OS_WIN) || defined(CARLA_OS_MAC) const AEffect* VSTPluginMain(audioMasterCallback audioMaster); -#else -const AEffect* VSTPluginMain(audioMasterCallback audioMaster) asm ("main"); -#endif CARLA_EXPORT __cdecl const AEffect* VSTPluginMain(audioMasterCallback audioMaster) @@ -94,6 +90,17 @@ const AEffect* VSTPluginMain(audioMasterCallback audioMaster) return VSTPluginMainInit(effect); } +#if ! (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) +CARLA_EXPORT __cdecl +const AEffect* VSTPluginMain_asm(audioMasterCallback audioMaster) asm ("main"); + +CARLA_EXPORT __cdecl +const AEffect* VSTPluginMain_asm(audioMasterCallback audioMaster) +{ + return VSTPluginMain(audioMaster); +} +#endif + intptr_t VSTAudioMaster(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) { const audioMasterCallback audioMaster = (audioMasterCallback)((VstObject*)effect->object)->audioMaster; diff --git a/source/plugin/win-def/carla-lv2_dsp+ui.def b/source/plugin/symbols/carla-lv2_dsp+ui.def similarity index 100% rename from source/plugin/win-def/carla-lv2_dsp+ui.def rename to source/plugin/symbols/carla-lv2_dsp+ui.def diff --git a/source/plugin/symbols/carla-lv2_dsp+ui.txt b/source/plugin/symbols/carla-lv2_dsp+ui.txt new file mode 100644 index 000000000..c9eae5bba --- /dev/null +++ b/source/plugin/symbols/carla-lv2_dsp+ui.txt @@ -0,0 +1,2 @@ +lv2_descriptor +lv2ui_descriptor diff --git a/source/plugin/symbols/carla-lv2_dsp+ui.version b/source/plugin/symbols/carla-lv2_dsp+ui.version new file mode 100644 index 000000000..328c6f907 --- /dev/null +++ b/source/plugin/symbols/carla-lv2_dsp+ui.version @@ -0,0 +1,4 @@ +{ + global: lv2_descriptor; lv2ui_descriptor; + local: *; +}; diff --git a/source/plugin/win-def/carla-lv2_dsp.def b/source/plugin/symbols/carla-lv2_dsp.def similarity index 100% rename from source/plugin/win-def/carla-lv2_dsp.def rename to source/plugin/symbols/carla-lv2_dsp.def diff --git a/source/plugin/symbols/carla-lv2_dsp.txt b/source/plugin/symbols/carla-lv2_dsp.txt new file mode 100644 index 000000000..8c47be6ac --- /dev/null +++ b/source/plugin/symbols/carla-lv2_dsp.txt @@ -0,0 +1 @@ +lv2_descriptor diff --git a/source/plugin/symbols/carla-lv2_dsp.version b/source/plugin/symbols/carla-lv2_dsp.version new file mode 100644 index 000000000..561f2152f --- /dev/null +++ b/source/plugin/symbols/carla-lv2_dsp.version @@ -0,0 +1,4 @@ +{ + global: lv2_descriptor; + local: *; +}; diff --git a/source/plugin/win-def/carla-lv2_ui.def b/source/plugin/symbols/carla-lv2_ui.def similarity index 100% rename from source/plugin/win-def/carla-lv2_ui.def rename to source/plugin/symbols/carla-lv2_ui.def diff --git a/source/plugin/symbols/carla-lv2_ui.txt b/source/plugin/symbols/carla-lv2_ui.txt new file mode 100644 index 000000000..9c38c04d1 --- /dev/null +++ b/source/plugin/symbols/carla-lv2_ui.txt @@ -0,0 +1 @@ +lv2ui_descriptor diff --git a/source/plugin/symbols/carla-lv2_ui.version b/source/plugin/symbols/carla-lv2_ui.version new file mode 100644 index 000000000..8700fd020 --- /dev/null +++ b/source/plugin/symbols/carla-lv2_ui.version @@ -0,0 +1,4 @@ +{ + global: lv2ui_descriptor; + local: *; +}; diff --git a/source/plugin/win-def/carla-native-plugin.def b/source/plugin/symbols/carla-native-plugin.def similarity index 100% rename from source/plugin/win-def/carla-native-plugin.def rename to source/plugin/symbols/carla-native-plugin.def diff --git a/source/plugin/symbols/carla-native-plugin.txt b/source/plugin/symbols/carla-native-plugin.txt new file mode 100644 index 000000000..04fecac3a --- /dev/null +++ b/source/plugin/symbols/carla-native-plugin.txt @@ -0,0 +1,10 @@ +carla_get_native_patchbay_plugin +carla_get_native_patchbay16_plugin +carla_get_native_patchbay32_plugin +carla_get_native_patchbay64_plugin +carla_get_native_patchbay_cv_plugin +carla_create_native_plugin_host_handle +carla_host_handle_free +carla_get_native_plugin_engine +carla_get_library_filename +carla_get_library_folder diff --git a/source/plugin/symbols/carla-native-plugin.version b/source/plugin/symbols/carla-native-plugin.version new file mode 100644 index 000000000..c06aa66c8 --- /dev/null +++ b/source/plugin/symbols/carla-native-plugin.version @@ -0,0 +1,13 @@ +{ + global: carla_get_native_patchbay_plugin; + carla_get_native_patchbay16_plugin; + carla_get_native_patchbay32_plugin; + carla_get_native_patchbay64_plugin; + carla_get_native_patchbay_cv_plugin; + carla_create_native_plugin_host_handle; + carla_host_handle_free; + carla_get_native_plugin_engine; + carla_get_library_filename; + carla_get_library_folder; + local: *; +}; diff --git a/source/plugin/win-def/carla-vst.def b/source/plugin/symbols/carla-vst.def similarity index 100% rename from source/plugin/win-def/carla-vst.def rename to source/plugin/symbols/carla-vst.def diff --git a/source/plugin/symbols/carla-vst.txt b/source/plugin/symbols/carla-vst.txt new file mode 100644 index 000000000..068a5ea64 --- /dev/null +++ b/source/plugin/symbols/carla-vst.txt @@ -0,0 +1 @@ +VSTPluginMain diff --git a/source/plugin/symbols/carla-vst.version b/source/plugin/symbols/carla-vst.version new file mode 100644 index 000000000..7ecf460ee --- /dev/null +++ b/source/plugin/symbols/carla-vst.version @@ -0,0 +1,4 @@ +{ + global: VSTPluginMain; main; + local: *; +};