From f72396d66db171e0192fb43cb58d854e79d0f891 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 2 Apr 2021 22:23:45 +0300 Subject: Auto-generate libcurl.expsym on MacOS --- libcurl/README-DEV | 4 -- libcurl/libcurl/.gitignore | 1 + libcurl/libcurl/buildfile | 34 ++++++++++++-- libcurl/libcurl/libcurl-symbols.expsym | 86 ---------------------------------- 4 files changed, 32 insertions(+), 93 deletions(-) delete mode 100644 libcurl/libcurl/libcurl-symbols.expsym diff --git a/libcurl/README-DEV b/libcurl/README-DEV index 623a560..d4e099d 100644 --- a/libcurl/README-DEV +++ b/libcurl/README-DEV @@ -13,10 +13,6 @@ Some macro values cannot be easily determined at the preprocessing time. We define them based on the supported platform tests and add libcurl/assert.c, containing compile-time assertions for the macros in question. -Copy the upstream's libtool-generated for MacOS libcurl-symbols.expsym file -and comment out (with #) the _curl_jmpenv symbol in it since it causes the -'cannot export hidden symbol' linked warning on MacOS. - Note that re-creating libcurl/curl_config.h from scratch every time we upgrade to a new upstream version would be a real pain. Instead we can only (un)define the newly introduced macros, comparing the already defined and currently used diff --git a/libcurl/libcurl/.gitignore b/libcurl/libcurl/.gitignore index 33c2835..b65af9a 100644 --- a/libcurl/libcurl/.gitignore +++ b/libcurl/libcurl/.gitignore @@ -1 +1,2 @@ libcurl.vers +libcurl.expsym diff --git a/libcurl/libcurl/buildfile b/libcurl/libcurl/buildfile index 056ca9f..450bcf9 100644 --- a/libcurl/libcurl/buildfile +++ b/libcurl/libcurl/buildfile @@ -25,8 +25,8 @@ bsd = ($tclass == 'bsd') macos = ($tclass == 'macos') windows = ($tclass == 'windows') -libs{curl}: vsc{libcurl}: include = ($linux || $bsd ? adhoc : false) -libs{curl}: esm{libcurl-symbols}: include = ($macos ? adhoc : false) +libs{curl}: vsc{libcurl}: include = ($linux || $bsd ? adhoc : false) +libs{curl}: esm{libcurl}: include = ($macos ? adhoc : false) vsc{libcurl}: lib/in{libcurl} { @@ -35,6 +35,34 @@ vsc{libcurl}: lib/in{libcurl} CURL_LT_SHLIB_VERSIONED_FLAVOUR = 'OPENSSL_' } +# Generate the exported symbol list file using the interface headers. +# +# Note that upstream auto-generate this file (named as libcurl-symbols.expsym) +# by using the nm utility, dumping symbols from object files and processing +# the output. This, in particular, results in the _curl_jmpenv symbol which +# causes 'cannot export hidden symbol' linker warning. +# +esm{libcurl}: include/curl/h{** -stdcheaders -typecheck-gcc} +{{ + diag sed $> # @@ TMP + + # Examples of the function declarations we need to match: + # + # CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, + # size_t *n); + # + # CURL_EXTERN const struct curl_easyoption * + # curl_easy_option_by_id (CURLoption id); + # + # Note that we need to avoid matching the function calls in macro expansions + # and mentioning functions in comments. Thus, we disallow the leading + # spaces, unless the leading CURL_EXTERN specifier is also present in the + # line. + # + cat $path($<) | \ + sed -n -e 's/^(\s*CURL_EXTERN\b.+\b)?(curl_\w+)\s*\(.*/_\2/p' >$path($>) +}} + # Build options. # c.poptions += -DBUILDING_LIBCURL -DHAVE_CONFIG_H \ @@ -95,7 +123,7 @@ switch $tclass, $tsys } case 'macos' { - c.loptions += "-Wl,-exported_symbols_list,$src_base/libcurl-symbols.expsym" + c.loptions += "-Wl,-exported_symbols_list,$out_base/libcurl.expsym" # @@ TMP Until erroneous -framework option suppression is fixed in build2. # diff --git a/libcurl/libcurl/libcurl-symbols.expsym b/libcurl/libcurl/libcurl-symbols.expsym deleted file mode 100644 index 48882de..0000000 --- a/libcurl/libcurl/libcurl-symbols.expsym +++ /dev/null @@ -1,86 +0,0 @@ -_curl_easy_cleanup -_curl_easy_duphandle -_curl_easy_escape -_curl_easy_getinfo -_curl_easy_init -_curl_easy_option_by_id -_curl_easy_option_by_name -_curl_easy_option_next -_curl_easy_pause -_curl_easy_perform -_curl_easy_recv -_curl_easy_reset -_curl_easy_send -_curl_easy_setopt -_curl_easy_strerror -_curl_easy_unescape -_curl_easy_upkeep -_curl_escape -_curl_formadd -_curl_formfree -_curl_formget -_curl_free -_curl_getdate -_curl_getenv -_curl_global_cleanup -_curl_global_init -_curl_global_init_mem -_curl_global_sslset -#_curl_jmpenv -_curl_maprintf -_curl_mfprintf -_curl_mime_addpart -_curl_mime_data -_curl_mime_data_cb -_curl_mime_encoder -_curl_mime_filedata -_curl_mime_filename -_curl_mime_free -_curl_mime_headers -_curl_mime_init -_curl_mime_name -_curl_mime_subparts -_curl_mime_type -_curl_mprintf -_curl_msnprintf -_curl_msprintf -_curl_multi_add_handle -_curl_multi_assign -_curl_multi_cleanup -_curl_multi_fdset -_curl_multi_info_read -_curl_multi_init -_curl_multi_perform -_curl_multi_poll -_curl_multi_remove_handle -_curl_multi_setopt -_curl_multi_socket -_curl_multi_socket_action -_curl_multi_socket_all -_curl_multi_strerror -_curl_multi_timeout -_curl_multi_wait -_curl_multi_wakeup -_curl_mvaprintf -_curl_mvfprintf -_curl_mvprintf -_curl_mvsnprintf -_curl_mvsprintf -_curl_pushheader_byname -_curl_pushheader_bynum -_curl_share_cleanup -_curl_share_init -_curl_share_setopt -_curl_share_strerror -_curl_slist_append -_curl_slist_free_all -_curl_strequal -_curl_strnequal -_curl_unescape -_curl_url -_curl_url_cleanup -_curl_url_dup -_curl_url_get -_curl_url_set -_curl_version -_curl_version_info -- cgit v1.1