cherry-pick into 1.2: lua: prevent LuaJIT from panicking. (#6994)#83
cherry-pick into 1.2: lua: prevent LuaJIT from panicking. (#6994)#83duderino merged 1 commit intoistio:release-1.2from duderino:jblatt_1_2_lua_crash
Conversation
Migration from the build recipes to foreign_cc rules resulted
in dependencies being built with different compiler flags.
Among other things, those compiler flags were added:
-ffunction-sections -fdata-sections
use of which leads to LuaJIT panicking:
PANIC: unprotected error in call to Lua API
and Envoy subsequently crashing.
Broken in envoyproxy#6168.
Fixes istio/istio#13722.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
|
/lgtm |
| + os.environ["TARGET_CFLAGS"] = os.environ.get("CFLAGS", "") | ||
| + os.environ["TARGET_LDFLAGS"] = os.environ.get("CFLAGS", "") | ||
| + os.environ["TARGET_CFLAGS"] = os.environ.get("CFLAGS", "") + " -fno-function-sections -fno-data-sections" | ||
| + os.environ["TARGET_LDFLAGS"] = os.environ.get("CFLAGS", "") + " -fno-function-sections -fno-data-sections" |
There was a problem hiding this comment.
Isn't there an old cut/paste error carried over?
Why would os.environ["TARGET_LDFLAGS"] not be os.environ.get("LDFLAGS" ...?
Also, isn't LDFLAGS the linker flag and then no need to have these -f that are compiler flags. (aren't linker flags prefixed with -l and -Wl or something?)
There was a problem hiding this comment.
I assumed this was intentional, but perhaps ask @lizan or on the original PR (envoyproxy#6168)?
There was a problem hiding this comment.
Yeah, looking at LuaJIT's Makefile, it's invoking compiler in place of linker (TARGET_LD= $(CROSS)$(CC)), so I believe that using CFLAGS is correct here.
There was a problem hiding this comment.
But isn't the override incorrect? LDFLAGS is supposed to override TARGET_LDFLAGS.
c.f. comment from the Makefile
https://github.com/LuaJIT/LuaJIT/blob/v2.1.0-beta3/src/Makefile#L181
* Add support for emscripten up to 1.38.39. Signed-off-by: John Plevyak <jplevyak@gmail.com>
Migration from the build recipes to foreign_cc rules resulted
in dependencies being built with different compiler flags.
Among other things, those compiler flags were added:
use of which leads to LuaJIT panicking:
and Envoy subsequently crashing.
Broken in envoyproxy#6168.
Fixes istio/istio#13722.
Signed-off-by: Piotr Sikora piotrsikora@google.com
For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md
Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
[Optional Fixes #Issue]
[Optional Deprecated:]