public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "james.hilliard1 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29621] librtld.os: in function `__register_frame': libgcc/unwind-dw2-fde.c:136: undefined reference to `malloc'
Date: Thu, 27 Oct 2022 21:35:21 +0000	[thread overview]
Message-ID: <bug-29621-131-SDNc48Udir@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29621-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29621

--- Comment #10 from James Hilliard <james.hilliard1 at gmail dot com> ---
(In reply to Adhemerval Zanella from comment #9)
> (In reply to James Hilliard from comment #8)
> > (In reply to Adhemerval Zanella from comment #7)
> > > (In reply to James Hilliard from comment #6)
> > > > 
> > > > Full commands:
> > > > git clone https://github.com/buildroot/buildroot.git
> > > > cd buildroot
> > > > git checkout e4ecf82f99f53e55d51e6f74ae5021473aa2bb1d
> > > > wget
> > > > http://autobuild.buildroot.net/results/883/
> > > > 883b171a856a63540908976592683527fdb21cd2/config
> > > > mv config .config
> > > > make glibc
> > > 
> > > Ok, with this one I can see the buildroot failure. It seems that it is
> > > misconfiguring the stage1 gcc, where the libgcc.a generated is relying on
> > > the libc for unwinding (thus why ld.so link is failing).
> > > 
> > > I mimic what build-many-glibcs.py [1] does (which is canonical way to build
> > > complete toolchain for glibc) and build a stage1 on buildroot system with:
> > > 
> > > ---
> > > ./configure \
> > >   --prefix=/tmp/buildroot/output/host \
> > >   --build=x86_64-pc-linux-gnu \
> > >   --host=x86_64-pc-linux-gnu \
> > >   --target=mips64el-glibc-linux-gnu \
> > 
> > This looks wrong, we aren't building for mips64el(which our autobuilders
> > also indicate does not have this particular build failure).
> 
> Our script builds only one toolchain with multilib enabled (which I think it
> is not the case for buildroot).  In any case, for stage1 either
> mips64el-glibc-linux-gnu or mipsel-glibc-linux-gnu works (since for mips64el
> gcc still can generates -mabi=32 code).

We're building with multilib disabled I think in buildroot here.

Maybe there's something in glibc broken for non-multilib builds?

> 
> > 
> > >   --sysconfdir=/tmp/buildroot/output/host/etc \
> > >   --localstatedir=/tmp/buildroot/output/host/var \
> > >   --target=mipsel-buildroot-linux-gnu \
> > 
> > Setting target a second time?
> 
> I copy/paste from the stage1 config we use in your script and forget to
> remove the mips64el one, using only mipsel-buildroot-linux-gnu should be
> suffice.
> 
> > 
> > >  
> > > --with-sysroot=/tmp/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot
> > > \
> > >   --with-gmp=/tmp/buildroot/output/host \
> > >   --with-mpc=/tmp/buildroot/output/host \
> > >   --with-mpfr=/tmp/buildroot/output/host \
> > >   --with-pkgversion="Buildroot 2022.08-383-ge4ecf82f99-dirty" \
> > >   --with-bugurl=http://bugs.buildroot.net/ \
> > >   --enable-initfini-array \
> > >   --disable-libssp \
> > >   --disable-shared \
> > >   --disable-threads \
> > >   --disable-libatomic \
> > >   --disable-decimal-float \
> > >   --disable-libffi \
> > >   --disable-libgomp \
> > >   --disable-libitm \
> > >   --disable-libmpx \
> > >   --disable-libquadmath \
> > >   --disable-libsanitizer \
> > >   --without-headers\
> > >   --with-newlib \
> > >   --enable-languages=c, \
> > >   --with-arch=mips32r3 --with-abi=32 --with-nan=legacy --with-fp-32=xx
> > > ---
> > 
> > I've attempted to make a build using this configuration but have not been
> > able to get a working build.
> > 
> > > 
> > > And with this stage1 gcc I could finish the glibc build. I am afraid you
> > > will need to sort this out on buildroot stage1 configuration flags used on
> > > gcc.
> > 
> > I've tested by patching our gcc stage1
> > configure(package/gcc/gcc-initial/gcc-initial.mk).
> > 
> > Replacing HOST_GCC_INITIAL_CONF_OPTS with this for testing:
> > HOST_GCC_INITIAL_CONF_OPTS = \
> > 	--build=x86_64-pc-linux-gnu \
> > 	--host=x86_64-pc-linux-gnu \
> > 	--target=$(GNU_TARGET_NAME) \
> > 	--with-sysroot=$(STAGING_DIR) \
> > 	--with-gmp=$(HOST_DIR) \
> > 	--with-mpc=$(HOST_DIR) \
> > 	--with-mpfr=$(HOST_DIR) \
> > 	--with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \
> > 	--with-bugurl=http://bugs.buildroot.net/ \
> > 	--enable-initfini-array \
> > 	--disable-libssp \
> > 	--disable-shared \
> > 	--disable-threads \
> > 	--disable-libatomic \
> > 	--disable-decimal-float \
> > 	--disable-libffi \
> > 	--disable-libgomp \
> > 	--disable-libitm \
> > 	--disable-libmpx \
> > 	--disable-libquadmath \
> > 	--disable-libsanitizer \
> > 	--without-headers \
> > 	--with-newlib \
> > 	--enable-languages=c, \
> > 	--with-arch=mips32r3 --with-abi=32 --with-nan=legacy --with-fp-32=xx
> > 
> > With this I get the same failure as before. Does this successfully build for
> > you?
> > 
> 
> I did not actually patches the buildroot build system, but rather rebuild
> the stage1 gcc at output/build/host-gcc-initial-11.3.0/build with the
> configuration, issued make install and rebuild the glibc
> (output/build/glibc-2.36-44-g2628500f5dff1dd99c49a09b418b3b1ea3a6b5d3/build).
> 
> It does show to work:
> 
> $ file elf/ld.so
> elf/ld.so: ELF 32-bit LSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV),
> dynamically linked, with debug_info, not stripped
> $ ./elf/ld.so --version
> ld.so (Buildroot) stable release version 2.36.
> Copyright (C) 2022 Free Software Foundation, Inc.
> [...]
> $ ./elf/ld.so ./libc.so
> GNU C Library (Buildroot) stable release version 2.36.
> [...]
> 
> At least qemu mips usermode can actually run the resulting loader.
> 
> > After patching gcc-initial.mk to test I do:
> > make clean
> > make glibc
> > 
> > > 
> > > [1]
> > > https://sourceware.org/git/?p=glibc.git;a=blob;f=scripts/build-many-glibcs.
> > > py;h=5af6f369ae04027911b3407c64716dd1571eae6a;hb=HEAD
> 
> I tried to hack the builroot system without much success, I also tried to
> mimic what build-many-glibcs.py does, but I keep seeing the build failure.
> 
> However, if I rebuild the gcc with my hacked config:
> 
> ./configure --prefix=/tmp/buildroot/output/host
> --sysconfdir=/tmp/buildroot/output/host/etc
> --localstatedir=/tmp/buildroot/output/host/var --disable-gtk-doc
> --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation
> --disable-debug --with-xmlto=no --with-fop=no --disable-nls
> --disable-dependency-tracking --target=mipsel-buildroot-linux-gnu
> --with-sysroot=/tmp/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot
> --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float
> --with-gmp=/tmp/buildroot/output/host --with-mpc=/tmp/buildroot/output/host
> --with-mpfr=/tmp/buildroot/output/host --with-pkgversion="Buildroot
> 2022.08-383-ge4ecf82f99-dirty" --with-bugurl=http://bugs.buildroot.net/
> --without-zstd --disable-libquadmath --disable-libquadmath-support
> --without-isl --without-cloog --with-arch=mips32r3 --with-abi=32
> --with-nan=legacy --with-fp-32=xx --enable-languages=c
> --enable-initfini-array --disable-libssp --disable-shared --without-headers
> --disable-threads --disable-libatomic --disable-decimal-float
> --disable-libffi --disable-libgomp --disable-libitm --disable-libmpx
> --disable-libquadmath --disable-libsanitizer --with-newlib
> 
> on the buildroot directory, reinstall it, and the glibc does finish. That's
> why I think there is something bogues on buildroot that I can't figure out.

Yeah, so building manually like that tends to bypass a lot of our build
environment and often ends up with built in host os utilities/dependencies
getting pulled in instead of the intended buildroot toolchain versions.

So a build succeeding outside of our env like that may not really mean a whole
lot in terms of it being a buildroot side bug as building manually may be using
a totally different environment that bypasses/sidesteps a bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-10-27 21:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 19:44 [Bug libc/29621] New: " james.hilliard1 at gmail dot com
2022-09-27 19:44 ` [Bug libc/29621] " james.hilliard1 at gmail dot com
2022-09-29 17:45 ` adhemerval.zanella at linaro dot org
2022-09-29 19:51 ` james.hilliard1 at gmail dot com
2022-10-17 12:42 ` adhemerval.zanella at linaro dot org
2022-10-26 18:54 ` james.hilliard1 at gmail dot com
2022-10-26 19:10 ` adhemerval.zanella at linaro dot org
2022-10-26 19:33 ` james.hilliard1 at gmail dot com
2022-10-27 14:04 ` adhemerval.zanella at linaro dot org
2022-10-27 19:57 ` james.hilliard1 at gmail dot com
2022-10-27 21:05 ` adhemerval.zanella at linaro dot org
2022-10-27 21:35 ` james.hilliard1 at gmail dot com [this message]
2022-10-28  5:28 ` fweimer at redhat dot com
2022-10-28 13:19 ` adhemerval.zanella at linaro dot org
2022-10-28 13:36 ` adhemerval.zanella at linaro dot org
2022-10-28 16:18 ` james.hilliard1 at gmail dot com
2022-10-28 16:32 ` adhemerval.zanella at linaro dot org
2022-10-28 21:23 ` james.hilliard1 at gmail dot com
2022-11-24 17:01 ` arnout at mind dot be
2022-11-24 17:21 ` arnout at mind dot be
2022-11-24 17:27 ` fweimer at redhat dot com
2023-08-07  9:37 ` sam at gentoo dot org
2024-01-11  9:41 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29621-131-SDNc48Udir@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).