Skip to content

Commit a905c77

Browse files
committed
duktape: add an upstream patch to link the shared libraries against libm
Those shared libraries use math functions like ceil but they didn't have a DT_NEEDED record against libm. While this is bad, it didn't cause a significant issue so nobody cared. But in Core 14 ceil (and maybe others) has become a GNU indirect function on at least amd64, then lacking the DT_NEEDED record can cause a crash as explained by http://maskray.me/blog/gnu-indirect-function#relocation-resolving-order. Backport the upstream patch to link against libm.
1 parent 706d3a7 commit a905c77

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 76047d3bf39ebf3b08a186432c686fa88375eb9a Mon Sep 17 00:00:00 2001
2+
From: tinywrkb <tinywrkb@gmail.com>
3+
Date: Thu, 17 Mar 2022 03:55:51 +0200
4+
Subject: [PATCH] UPSTREAM: dist-files/Makefile.sharedlibrary: link against
5+
libm
6+
7+
Closes #2464.
8+
9+
(cherry picked from commit d898ad3920cb08d6918d11d9678bae28393a82d1)
10+
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
11+
---
12+
AUTHORS.rst | 1 +
13+
Makefile.sharedlibrary | 4 ++--
14+
2 files changed, 3 insertions(+), 2 deletions(-)
15+
16+
diff --git a/AUTHORS.rst b/AUTHORS.rst
17+
index a9eeba5a..ab58be78 100644
18+
--- a/AUTHORS.rst
19+
+++ b/AUTHORS.rst
20+
@@ -70,6 +70,7 @@ and agreed to irrevocably license their contributions under the Duktape
21+
* William Parks (https://github.com/WilliamParks)
22+
* Sam Hellawell (https://github.com/samhellawell)
23+
* Vladislavs Sokurenko (https://github.com/sokurenko)
24+
+* tinywrkb (https://github.com/tinywrkb)
25+
26+
Other contributions
27+
===================
28+
diff --git a/Makefile.sharedlibrary b/Makefile.sharedlibrary
29+
index bf5c0cb6..d262c41f 100644
30+
--- a/Makefile.sharedlibrary
31+
+++ b/Makefile.sharedlibrary
32+
@@ -71,11 +71,11 @@ all: libduktape.$(SO_REALNAME_SUFFIX) libduktaped.$(SO_REALNAME_SUFFIX) duktape.
33+
34+
libduktape.$(SO_REALNAME_SUFFIX):
35+
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fPIC -Wall -Wextra -Os -Wl,$(LD_SONAME_ARG),libduktape.$(SO_SONAME_SUFFIX) \
36+
- -o $@ $(DUKTAPE_SRCDIR)/duktape.c
37+
+ -o $@ $(DUKTAPE_SRCDIR)/duktape.c -lm
38+
39+
libduktaped.$(SO_REALNAME_SUFFIX):
40+
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fPIC -g -Wall -Wextra -Os -Wl,$(LD_SONAME_ARG),libduktaped.$(SO_SONAME_SUFFIX) \
41+
- -o $@ $(DUKTAPE_SRCDIR)/duktape.c
42+
+ -o $@ $(DUKTAPE_SRCDIR)/duktape.c -lm
43+
44+
duktape.pc:
45+
sed -e "s|@PREFIX@|$(INSTALL_PREFIX)|" \
46+
--
47+
2.55.0
48+

lang-js/duktape/spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
VER=2.7.0
2+
REL=1
23
SRCS="tbl::https://duktape.org/duktape-$VER.tar.xz"
34
CHKSUMS="sha256::90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890"
45
CHKUPDATE="anitya::id=21345"

0 commit comments

Comments
 (0)