Package: st
Followup-For: Bug #1065797
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
Control: tags -1 patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * debian/patches/02-implicit-declarations.patch: Fix an improper macro
    feature check.  (Closes #1065797, LP: #2060973).
  * debian/patches/1032955_riscv_support.patch: Add support for RISC-V
    CPU.  Thanks to Steven Liu <liuq...@kuaishou.com>. (LP: #2061639).


Thanks for considering the patch.


-- System Information:
Debian Release: bookworm/sid
  APT prefers jammy-updates
  APT policy: (500, 'jammy-updates'), (500, 'jammy-security'), (500, 'jammy'), 
(100, 'jammy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-27-generic (SMP w/10 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru st-1.9/debian/patches/02-implicit-declarations.patch 
st-1.9/debian/patches/02-implicit-declarations.patch
--- st-1.9/debian/patches/02-implicit-declarations.patch        1969-12-31 
17:00:00.000000000 -0700
+++ st-1.9/debian/patches/02-implicit-declarations.patch        2024-04-15 
10:06:57.000000000 -0600
@@ -0,0 +1,21 @@
+Description: Fix an improper macro feature check
+ This resolves the implicit declaration error on armhf
+Author: Zixing Liu <zixing....@canonical.com>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1065797
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/st/+bug/2060973
+Forwarded: no
+Last-Update: 2024-04-15
+---
+Index: st/examples/res.c
+===================================================================
+--- st.orig/examples/res.c
++++ st/examples/res.c
+@@ -82,7 +82,7 @@
+ #endif
+ 
+ /* New in Solaris 7 */
+-#if !defined(_getshort) && defined(ns_get16)
++#if !defined(_getshort) && defined(NS_GET16)
+ #define _getshort(cp) ns_get16(cp)
+ #endif
+ 
diff -Nru st-1.9/debian/patches/1032955_riscv_support.patch 
st-1.9/debian/patches/1032955_riscv_support.patch
--- st-1.9/debian/patches/1032955_riscv_support.patch   1969-12-31 
17:00:00.000000000 -0700
+++ st-1.9/debian/patches/1032955_riscv_support.patch   2024-04-15 
10:06:57.000000000 -0600
@@ -0,0 +1,111 @@
+Description: Add support for RISC-V CPU
+Author: Steven Liu <liuq...@kuaishou.com>
+Origin: 
https://github.com/ossrs/state-threads/commit/c865500b8c1f4821cc77627094c1a30fef403dbb
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1032955
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/st/+bug/2061639
+Applied-Upstream: 
https://github.com/ossrs/state-threads/commit/c865500b8c1f4821cc77627094c1a30fef403dbb
+Reviewed-by: Zixing Liu <zixing....@canonical.com>
+Last-Update: 2022-07-20
+---
+Index: st-1.9/md.S
+===================================================================
+--- st-1.9.orig/md.S
++++ st-1.9/md.S
+@@ -431,5 +431,81 @@ _st_md_cxt_restore:
+ 
+ /****************************************************************/
+ 
++#elif defined(__riscv)
++
++    /****************************************************************/
++    /*
++     * Internal __jmp_buf layout
++     * riscv-asm: 
https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md
++     */
++    #define JB_SP  0    /* A0, SP, Stack pointer */
++    #define JB_RA  1    /* RA, Return address */
++    #define JB_FP  2    /* FP/S0 Frame pointer */
++    #define JB_S1  3    /* S1 Saved register*/
++    #define JB_S2  4    /* S2-S11,  Saved register */
++    #define JB_S3  5    /* S2-S11,  Saved register */
++    #define JB_S4  6    /* S2-S11,  Saved register */
++    #define JB_S5  7    /* S2-S11,  Saved register */
++    #define JB_S6  8    /* S2-S11,  Saved register */
++    #define JB_S7  9    /* S2-S11,  Saved register */
++    #define JB_S8  10    /* S2-S11,  Saved register */
++    #define JB_S9  11   /* S2-S11,  Saved register */
++    #define JB_S10 12   /* S2-S11,  Saved register */
++    #define JB_S11 13   /* S2-S11,  Saved register */
++
++
++      .file "md.S"
++      .text
++
++      /* _st_md_cxt_save(__jmp_buf env) */ /* The env is $a0, 
https://en.wikipedia.org/wiki/RISC-V#Register_sets */
++      .globl _st_md_cxt_save
++      .type _st_md_cxt_save, %function
++      .align 2
++    _st_md_cxt_save:
++      sd    sp,  JB_SP  * 8(a0)
++      sd    ra,  JB_RA  * 8(a0)
++      sd    s0,  JB_FP  * 8(a0)
++      sd    s1,  JB_S1  * 8(a0)
++      sd    s2,  JB_S2  * 8(a0)
++      sd    s3,  JB_S3  * 8(a0)
++      sd    s4,  JB_S4  * 8(a0)
++      sd    s5,  JB_S5  * 8(a0)
++      sd    s6,  JB_S6  * 8(a0)
++      sd    s7,  JB_S7  * 8(a0)
++      sd    s8,  JB_S8  * 8(a0)
++      sd    s9,  JB_S9  * 8(a0)
++      sd    s10, JB_S10 * 8(a0)
++      sd    s11, JB_S11 * 8(a0)
++      li    a0,  0
++      jr    ra
++      .size _st_md_cxt_save, .-_st_md_cxt_save
++
++    /****************************************************************/
++
++      /* _st_md_cxt_restore(__jmp_buf env, int val) */
++      .globl _st_md_cxt_restore
++      .type _st_md_cxt_restore, %function
++      .align 2
++    _st_md_cxt_restore:
++      ld        sp,  JB_SP  * 8(a0)
++      ld        ra,  JB_RA  * 8(a0)
++      ld        s0,  JB_FP  * 8(a0)
++      ld        s1,  JB_S1  * 8(a0)
++      ld        s2,  JB_S2  * 8(a0)
++      ld        s3,  JB_S3  * 8(a0)
++      ld        s4,  JB_S4  * 8(a0)
++      ld        s5,  JB_S5  * 8(a0)
++      ld        s6,  JB_S6  * 8(a0)
++      ld        s7,  JB_S7  * 8(a0)
++      ld        s8,  JB_S8  * 8(a0)
++      ld        s9,  JB_S9  * 8(a0)
++      ld        s10, JB_S10 * 8(a0)
++      ld        s11, JB_S11 * 8(a0)
++      li        a0,  1
++      jr        ra
++      .size _st_md_cxt_restore, .-_st_md_cxt_restore
++
++    /****************************************************************/
++
+ #endif
+ 
+Index: st-1.9/md.h
+===================================================================
+--- st-1.9.orig/md.h
++++ st-1.9/md.h
+@@ -442,6 +442,11 @@
+ #error "ARM64/Linux pre-glibc2 not supported yet"
+ #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
+ 
++#elif defined(__riscv)
++#define MD_STACK_GROWS_DOWN
++#define MD_USE_BUILTIN_SETJMP
++#define MD_GET_SP(_t) *((long *)&((_t)->context[0].__jmpbuf[0]))
++
+ #elif defined(__s390__)
+ #define MD_STACK_GROWS_DOWN
+ 
diff -Nru st-1.9/debian/patches/series st-1.9/debian/patches/series
--- st-1.9/debian/patches/series        2020-06-20 17:29:23.000000000 -0600
+++ st-1.9/debian/patches/series        2024-04-15 10:06:57.000000000 -0600
@@ -1,3 +1,5 @@
 00-kfreebsd.patch
 01-private-symbols.patch
 791928_arm64_support.patch
+02-implicit-declarations.patch
+1032955_riscv_support.patch

Reply via email to