diff mbox series

glibc: fix new upstream build issue with DEBUG_BUILD build

Message ID 20220807160445.2446821-1-Martin.Jansa@gmail.com
State Accepted, archived
Commit 57a0e5ebac924015d3059695e731b28067be4568
Headers show
Series glibc: fix new upstream build issue with DEBUG_BUILD build | expand

Commit Message

Martin Jansa Aug. 7, 2022, 4:04 p.m. UTC
* fix SRCREV to match with glibc-2.36 tag
* refresh 0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch
  (just different commit SHA in master and 2.35 branch)

* add proposed fixes for build failure with DEBUG_BUILD:
  http://errors.yoctoproject.org/Errors/Details/663898/

86_64-oe-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse  --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0                      -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0                      -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot-native=  -Wl,-z,relro,-z,now -fuse-ld=bfd  -nostdlib -nostartfiles -r -o TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os '-Wl,-(' TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/dl-allobjs.os TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/rtld-libc.a -lgcc '-Wl,-)' \
	  -Wl,-Map,TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os.map
x86_64-oe-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse  --sysroot=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0                      -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0=/usr/src/debug/glibc/2.36-r0                      -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot=                      -fdebug-prefix-map=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot-native=  -Wl,-z,relro,-z,now -fuse-ld=bfd  -nostdlib -nostartfiles -shared -o TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/ld.so.new		\
	  -Wl,-z,relro -Wl,-z,defs -Wl,-z,now	\
	  -Wl,-z,pack-relative-relocs \
	  TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os -Wl,--version-script=TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/ld.map		\
	  -Wl,-soname=ld-linux-x86-64.so.2
TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/recipe-sysroot-native/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/12.1.0/ld.bfd: TOPDIR/tmp-glibc/work/core2-64-oe-linux/glibc/2.36-r0/build-x86_64-oe-linux/elf/librtld.os: in function `_dl_load_cache_lookup':
/usr/src/debug/glibc/2.36-r0/git/elf/dl-cache.c:513: undefined reference to `strcpy'
collect2: error: ld returned 1 exit status

  introduced in 2.36 version, with:
  https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=6b9006bfb0

  upstream report with this fix proposed:
  https://sourceware.org/bugzilla/show_bug.cgi?id=29454

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/recipes-core/glibc/glibc-version.inc     |  2 +-
 ...lement-a-useful-version-of-_startup_.patch |  8 ++---
 .../0002-x86-Fix-STRCPY-symbol-name.patch     | 23 ++++++++++++
 .../glibc/0003-Add-RTLD-hook-for-strcpy.patch | 35 +++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.36.bb         |  2 ++
 5 files changed, 65 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-core/glibc/glibc/0002-x86-Fix-STRCPY-symbol-name.patch
 create mode 100644 meta/recipes-core/glibc/glibc/0003-Add-RTLD-hook-for-strcpy.patch
diff mbox series

Patch

diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
index b6da2c345d..0fa6ac39c4 100644
--- a/meta/recipes-core/glibc/glibc-version.inc
+++ b/meta/recipes-core/glibc/glibc-version.inc
@@ -1,6 +1,6 @@ 
 SRCBRANCH ?= "release/2.36/master"
 PV = "2.36"
-SRCREV_glibc ?= "c74bb93cfdb04d49155b0e30983a3c866167bbca"
+SRCREV_glibc ?= "c804cd1c00adde061ca51711f63068c103e94eef"
 SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87"
 
 GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
diff --git a/meta/recipes-core/glibc/glibc/0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch b/meta/recipes-core/glibc/glibc/0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch
index 2421a63605..befac35e84 100644
--- a/meta/recipes-core/glibc/glibc/0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch
+++ b/meta/recipes-core/glibc/glibc/0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch
@@ -1,13 +1,13 @@ 
-From 6b8959add09e425df262bf9178b39ca35bc4003c Mon Sep 17 00:00:00 2001
+From 464f0a4f53fc68758760a34199a257d0ec0775d4 Mon Sep 17 00:00:00 2001
 From: Martin Jansa <Martin.Jansa@gmail.com>
-Date: Sun, 24 Jul 2022 19:41:41 +0200
+Date: Sun, 7 Aug 2022 12:51:48 +0200
 Subject: [PATCH] Revert "Linux: Implement a useful version of _startup_fatal"
 
-This reverts commit 2d05ba7f8ef979947e910a37ae8115a816eb4d08.
+This reverts commit a2a6bce7d7e52c1c34369a7da62c501cc350bc31.
+
 Upstream-Status: Inappropriate [temporary work around]
 
 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-
 ---
  sysdeps/unix/sysv/linux/i386/startup.h | 23 ++++++++++++---
  sysdeps/unix/sysv/linux/ia64/startup.h | 22 ---------------
diff --git a/meta/recipes-core/glibc/glibc/0002-x86-Fix-STRCPY-symbol-name.patch b/meta/recipes-core/glibc/glibc/0002-x86-Fix-STRCPY-symbol-name.patch
new file mode 100644
index 0000000000..326aca6e0c
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-x86-Fix-STRCPY-symbol-name.patch
@@ -0,0 +1,23 @@ 
+From 67aa386a4b5ff54994e157875f3abe99763b5bf7 Mon Sep 17 00:00:00 2001
+From: Noah Goldstein <goldstein.w.n@gmail.com>
+Date: Sun, 7 Aug 2022 22:42:30 +0800
+Subject: [PATCH] x86: Fix STRCPY symbol name
+
+Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=29454]
+---
+ sysdeps/x86_64/multiarch/strcpy-sse2.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/x86_64/multiarch/strcpy-sse2.S b/sysdeps/x86_64/multiarch/strcpy-sse2.S
+index e29b411314..d6b9bae5f8 100644
+--- a/sysdeps/x86_64/multiarch/strcpy-sse2.S
++++ b/sysdeps/x86_64/multiarch/strcpy-sse2.S
+@@ -22,7 +22,7 @@
+ 
+ # include <sysdep.h>
+ 
+-# ifndef STPCPY
++# ifndef STRCPY
+ #  define STRCPY __strcpy_sse2
+ # endif
+ 
diff --git a/meta/recipes-core/glibc/glibc/0003-Add-RTLD-hook-for-strcpy.patch b/meta/recipes-core/glibc/glibc/0003-Add-RTLD-hook-for-strcpy.patch
new file mode 100644
index 0000000000..64a7a307fe
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0003-Add-RTLD-hook-for-strcpy.patch
@@ -0,0 +1,35 @@ 
+From 64351e4b48a02c453ca9ed667d358ad44df6bf93 Mon Sep 17 00:00:00 2001
+From: Noah Goldstein <goldstein.w.n@gmail.com>
+Date: Sun, 7 Aug 2022 23:54:19 +0800
+Subject: [PATCH] Add RTLD hook for strcpy
+
+Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=29454]
+---
+ sysdeps/x86_64/multiarch/rtld-strcpy.S | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+ create mode 100644 sysdeps/x86_64/multiarch/rtld-strcpy.S
+
+diff --git a/sysdeps/x86_64/multiarch/rtld-strcpy.S b/sysdeps/x86_64/multiarch/rtld-strcpy.S
+new file mode 100644
+index 0000000000..19439c553d
+--- /dev/null
++++ b/sysdeps/x86_64/multiarch/rtld-strcpy.S
+@@ -0,0 +1,18 @@
++/* Copyright (C) 2022 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <https://www.gnu.org/licenses/>.  */
++
++#include "../strcpy.S"
diff --git a/meta/recipes-core/glibc/glibc_2.36.bb b/meta/recipes-core/glibc/glibc_2.36.bb
index f4504282f6..97bab9c381 100644
--- a/meta/recipes-core/glibc/glibc_2.36.bb
+++ b/meta/recipes-core/glibc/glibc_2.36.bb
@@ -52,6 +52,8 @@  SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \
            \
            file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \
+           file://0002-x86-Fix-STRCPY-symbol-name.patch \
+           file://0003-Add-RTLD-hook-for-strcpy.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"