Skip to content

Commit

Permalink
lua: export symbols of luajit by default (envoyproxy#21102)
Browse files Browse the repository at this point in the history
Signed-off-by: wbpcode <wangbaiping@corp.netease.com>
  • Loading branch information
code authored May 2, 2022
1 parent aa19a78 commit 6abcebc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ exports_files([
"sh_test_wrapper.sh",
"test_for_benchmark_wrapper.sh",
"repository_locations.bzl",
"exported_symbols.txt",
])

genrule(
Expand Down
4 changes: 2 additions & 2 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ The following optional features can be disabled on the Bazel build command-line:
The following optional features can be enabled on the Bazel build command-line:

* Exported symbols during linking with `--define exported_symbols=enabled`.
This is useful in cases where you have a lua script that loads shared object libraries, such as
those installed via luarocks.
This config will exports all symbols and results in larger binary size. If partial symbols export
is required and target platform is Linux, then `bazel/exported_symbols.txt` can be used to land it.
* Perf annotation with `--define perf_annotation=enabled` (see
source/common/common/perf_annotation.h for details).
* BoringSSL can be built in a FIPS-compliant mode with `--define boringssl=fips`
Expand Down
18 changes: 17 additions & 1 deletion bazel/envoy_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def envoy_cc_binary(
linkopts = [],
tags = [],
features = []):
linker_inputs = _envoy_exported_symbols_input()

if not linkopts:
linkopts = _envoy_linkopts()
if stamped:
Expand All @@ -32,6 +34,7 @@ def envoy_cc_binary(
name = name,
srcs = srcs,
data = data,
additional_linker_inputs = linker_inputs,
copts = envoy_copts(repository),
linkopts = linkopts,
testonly = testonly,
Expand All @@ -44,12 +47,25 @@ def envoy_cc_binary(
features = features,
)

def _envoy_exported_symbols_input():
return ["@envoy//bazel:exported_symbols.txt"]

# Default symbols to be exported.
# TODO(wbpcode): make this work correctly for apple/darwin.
def _envoy_default_exported_symbols():
return select({
"@envoy//bazel:linux": [
"-Wl,--dynamic-list=$(location @envoy//bazel:exported_symbols.txt)",
],
"//conditions:default": [],
})

# Select the given values if exporting is enabled in the current build.
def _envoy_select_exported_symbols(xs):
return select({
"@envoy//bazel:enable_exported_symbols": xs,
"//conditions:default": [],
})
}) + _envoy_default_exported_symbols()

# Compute the final linkopts based on various options.
def _envoy_linkopts():
Expand Down
3 changes: 3 additions & 0 deletions bazel/exported_symbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
lua*;
};
2 changes: 2 additions & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Minor Behavior Changes
any frame is received the assumption is that the connection is working. This behavior change
can be reverted by setting the ``envoy.reloadable_features.http2_delay_keepalive_timeout`` runtime
flag to false.
* lua: export symbols of LuaJit by default on Linux. This is useful in cases where you have a lua script
that loads shared object libraries, such as those installed via luarocks.
* thrift: add validate_clusters in :ref:`RouteConfiguration <envoy_v3_api_msg_extensions.filters.network.thrift_proxy.v3.RouteConfiguration>` to override the default behavior of cluster validation.
* tls: if both :ref:`match_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_subject_alt_names>` and :ref:`match_typed_subject_alt_names <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CertificateValidationContext.match_typed_subject_alt_names>` are specified, the former (deprecated) field is ignored. Previously, setting both fields would result in an error.
* tls: removed SHA-1 cipher suites from the server-side defaults.
Expand Down

0 comments on commit 6abcebc

Please sign in to comment.