Source: newlib
Severity: normal
Tags: patch

Dear Maintainer,

When using nano.specs, newlib declares a small struct _reent (96 bytes), but 
libm is still compiled against the full struct _reent (more than 1000 bytes). 
Gamma calculation writes signgam outside the small struct _reent.

libm.a compiled against the small struct _reent should be used with nano.specs.

Here is a patch correcting the problem by keeping a libm_nano.a in the package, 
and doing the replacement in nano.specs as the others "nano" libraries.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-3-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru newlib-3.1.0.20181231/debian/changelog 
newlib-3.1.0.20181231/debian/changelog
--- newlib-3.1.0.20181231/debian/changelog      2019-02-11 07:19:52.000000000 
+0100
+++ newlib-3.1.0.20181231/debian/changelog      2020-01-29 18:53:47.000000000 
+0100
@@ -1,3 +1,10 @@
+newlib (3.1.0.20181231-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Include libm_nano.a in package
+
+ -- Damien Nicolet <[email protected]>  Wed, 29 Jan 2020 18:53:47 +0100
+
 newlib (3.1.0.20181231-1) unstable; urgency=medium
 
   * New upstream version 3.1.0.20181231
diff -Nru newlib-3.1.0.20181231/debian/patches/fix-use-libm-nano-specs.patch 
newlib-3.1.0.20181231/debian/patches/fix-use-libm-nano-specs.patch
--- newlib-3.1.0.20181231/debian/patches/fix-use-libm-nano-specs.patch  
1970-01-01 01:00:00.000000000 +0100
+++ newlib-3.1.0.20181231/debian/patches/fix-use-libm-nano-specs.patch  
2020-01-29 18:53:47.000000000 +0100
@@ -0,0 +1,13 @@
+Index: newlib-3.1.0.20181231/libgloss/arm/elf-nano.specs
+===================================================================
+--- newlib-3.1.0.20181231.orig/libgloss/arm/elf-nano.specs
++++ newlib-3.1.0.20181231/libgloss/arm/elf-nano.specs
+@@ -15,7 +15,7 @@
+ %(nano_link_gcc_c_sequence) --start-group %G %(nano_libc) %(nano_libgloss) 
--end-group
+ 
+ *link:
+-%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) 
%:replace-outfile(-lrdimon -lrdimon_nano) %:replace-outfile(-lstdc++ 
-lstdc++_nano) %:replace-outfile(-lsupc++ -lsupc++_nano)
++%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) 
%:replace-outfile(-lm -lm_nano) %:replace-outfile(-lrdimon -lrdimon_nano) 
%:replace-outfile(-lstdc++ -lstdc++_nano) %:replace-outfile(-lsupc++ 
-lsupc++_nano)
+ 
+ *lib:
+ %{!shared:%{g*:-lg_nano} %{!p:%{!pg:-lc_nano}}%{p:-lc_p}%{pg:-lc_p}}
diff -Nru newlib-3.1.0.20181231/debian/patches/series 
newlib-3.1.0.20181231/debian/patches/series
--- newlib-3.1.0.20181231/debian/patches/series 2019-02-11 07:19:52.000000000 
+0100
+++ newlib-3.1.0.20181231/debian/patches/series 2020-01-29 18:53:47.000000000 
+0100
@@ -1,2 +1,3 @@
 reproducible-builds-locale.patch
 fix-include-paths-nano-specs.patch
+fix-use-libm-nano-specs.patch
diff -Nru newlib-3.1.0.20181231/debian/rules newlib-3.1.0.20181231/debian/rules
--- newlib-3.1.0.20181231/debian/rules  2019-02-11 07:19:52.000000000 +0100
+++ newlib-3.1.0.20181231/debian/rules  2020-01-29 18:53:47.000000000 +0100
@@ -87,7 +87,7 @@
        dh_auto_install -B$(BUILD_NANO_DIR) --destdir debian/tmp_nano 
--max-parallel=1
        #
        # Rename nano lib* files to lib*_nano
-       find $(TMP_NANO_DIR) -regex ".*/lib\(c\|g\|rdimon\)\.a" \
+       find $(TMP_NANO_DIR) -regex ".*/lib\(c\|g\|m\|rdimon\)\.a" \
                -exec rename 's@$(TMP_NANO_DIR)/(.*).a@$(TMP_DIR)/$$1_nano.a@' 
\{\} \+
        #
        # Move nano's version of newlib.h to nano/newlib.h

Reply via email to