Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2020 17:02:20 -0800
From:      bob prohaska <fbsd@www.zefox.net>
To:        Mark Millard <marklmi@yahoo.com>
Cc:        bob prohaska <fbsd@www.zefox.net>, freebsd-arm@freebsd.org
Subject:   Re: Migrating from -current to stable/12 on RPI2B (ARMv7)
Message-ID:  <20201229010220.GA36311@www.zefox.net>
In-Reply-To: <CB0E5ECD-CDDA-46A7-812B-744AF7645A78@yahoo.com>
References:  <20201228044840.GA28380@www.zefox.net> <F9CB3890-5E07-46C9-AC40-D968F8B51B1F@yahoo.com> <20201228185622.GB28380@www.zefox.net> <E1EC1332-62D8-4E51-BF4D-9812AF7EF44B@yahoo.com> <2C1E2F87-2FC3-481C-A508-C76B2D7CFF7F@yahoo.com> <619A02CC-0EBA-4B50-A3BB-C326996AE706@yahoo.com> <B6A3C3C8-4AB9-43B5-A93F-8F2B6DE5E5E9@yahoo.com> <CB0E5ECD-CDDA-46A7-812B-744AF7645A78@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 28, 2020 at 04:14:51PM -0800, Mark Millard wrote:
> [I get the problem as well! I report a backtrace of the failure
> and some more.]
>
=20
Relieved to see it's reproducible. =20

Thanks for investigating! =20

bob prohaska



> On 2020-Dec-28, at 14:04, Mark Millard <marklmi at yahoo.com> wrote:
>=20
> > On 2020-Dec-28, at 13:19, Mark Millard <marklmi at yahoo.com> wrote:
> >=20
> >> On 2020-Dec-28, at 12:55, Mark Millard <marklmi at yahoo.com> wrote:
> >>>=20
> >>>=20
> >>> On 2020-Dec-28, at 12:07, Mark Millard <marklmi at yahoo.com> wrote:
> >>>=20
> >>>=20
> >>>> On 2020-Dec-28, at 10:56, bob prohaska <fbsd at www.zefox.net> wrote:
> >>>>=20
> >>>>> On Sun, Dec 27, 2020 at 10:10:18PM -0800, Mark Millard wrote:
> >>>>>>=20
> >>>>>>=20
> >>>>>> On 2020-Dec-27, at 20:48, bob prohaska <fbsd@www.zefox.net> wrote:
> >>>>>>=20
> >>>>>>> . . .
> >>>>>>=20
> >>>>> I didn't know about LDFLAGS, but a re-try with=20
> >>>>> -j1 and LDFLAGS.lld+=3D -Wl,--threads=3D1
> >>>>> (apparently the syntax changed) in /etc/make.conf=20
> >>>>> promptly reproduced the error.=20
> >>>>=20
> >>>> Hmm. It been a while since I did a native build instead of a
> >>>> cross build. The cross build context has RAM and does not
> >>>> use the assignment so I'd not noticed.
> >>>>=20
> >>>> Thanks for the report!
> >>>=20
> >>> lld for LLVM 10 always had --no-threads as I now understand
> >>> and stable/12 still has/uses/needs LLVM 10.0.1 (with
> >>> updates).
> >>>=20
> >>> That means that lld from LLVM 11 was in use (FreeBSD
> >>> 13's system ld). The build was probably trying to build
> >>> some LLVM 10.0.1 final+ materials for bootstrap style
> >>> build use in later build stages (older FreeBSD targeting).
> >>> It likely had not gotten to the stage of building freebsd
> >>> stable/12 material itself.
> >>>=20
> >>> Attempting to build devel/llvm10 might well have the same
> >>> issue without having to involve an extra FreeBSD source
> >>> tree or build.
> >>=20
> >> There is another gotcha-issue with the change from --no-threads
> >> to --threads=3D1 based on neither working for both 10.0.x and
> >> 11.0.y: which ever one is listed in /etc/make.conf (say) will be
> >> wrong for other one of:
> >>=20
> >> A) building the bootstrap toolchain
> >> B) using the bootstrap toolchain
> >>=20
> >> The LDFLAGS.lld definition would need to be conditional on the
> >> distinction in order to be correct inside each type of context.
> >=20
> > I've started an experiment going another direction: an armv7
> > context with lots of RAM (and faster processing) with a
> > 13 attempting to build a stable/12 . It is via a chroot into
> > an armv7 13 world on a 8 GiByte, 4-core Cortex-A57 based
> > OverDrive 1000 running aarch64 13. Each process should still
> > be limited to what 32-bit systems allow but overall the
> > system is not that limited. I used -j4 .
> >=20
> > If such still got the error, then there would likely be
> > implications about the error and it would be unlikely
> > that it would work on the RPi2 v1.1 . (But I expect that
> > it will not get the error.)
> >=20
> > Root owns file system involved and is doing the build.
> >=20
> > It did report:
> >=20
> > make[1]: "/usr/fbsd/stable-12-src/Makefile.inc1" line 344: SYSTEM_COMPI=
LER: libclang will be built for bootstrapping a cross-compiler.
> > make[1]: "/usr/fbsd/stable-12-src/Makefile.inc1" line 349: SYSTEM_LINKE=
R: libclang will be built for bootstrapping a cross-linker.
> >=20
> > I already had a stable-12-src branch from git experiments
> > but the matching worktree was missing despite being still
> > registered. So the worktree recreation was:
> >=20
> > # git worktree add -f ../stable-12-src stable-12-src
> > Preparing worktree (checking out 'stable-12-src')
> > Updating files: 100% (81363/81363), done.
> > HEAD is now at f4d0bc6aa6b9 MFC r354991-r354992 (by lwhsu)
>=20
> For armv7 13's context being based on:
>=20
> WITH_ASSERT_DEBUG=3D
> WITH_LLVM_ASSERTIONS=3D
> WITHOUT_MALLOC_PRODUCTION=3D
> WITH_DEBUG_FILES=3D
> -mcpu=3Dcortex-a7
> -g in use despite -O2 or such optimizations.
>=20
> (The WITHOUT_MALLOC_PRODUCTION is because of a typo
> in the attempt to have set WITH_MALLOC_PRODUCTION.)
>=20
> I was not using --threads=3D1 since it would fail for later
> build stages.
>=20
> The being-built context was based on:
>=20
> WITH_ASSERT_DEBUG=3D
> WITHOUT_LLVM_ASSERTIONS=3D
> WITH_MALLOC_PRODUCTION=3D
> WITH_DEBUG_FILES=3D
> -mcpu=3Dcortex-a7
> -g in use despite -O2 or such optimizations.
>=20
> I got what follows. (But note that the ARM64TODO: fill_fpregs32c++
> is likely from the handling of the process crash already in
> process and is not contributing to the problem starting.)
>=20
> . . .
> --- all_subdir_usr.bin/clang/clang ---
> [Creating objdir /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm=
=2Earmv7/tmp/obj-tools/usr.bin/clang/clang...]
> Building /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/t=
mp/obj-tools/usr.bin/clang/clang/cc1_main.o
> Building /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/t=
mp/obj-tools/usr.bin/clang/clang/cc1as_main.o
> Building /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/t=
mp/obj-tools/usr.bin/clang/clang/cc1gen_reproducer_main.o
> Building /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/t=
mp/obj-tools/usr.bin/clang/clang/driver.o
> Building /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/t=
mp/obj-tools/usr.bin/clang/clang/clang.full
> --- clang.full ---
> LLVM ERROR: out of memory
> PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and includ=
e the crash backtrace.
> Stack dump:
> 0.      Program arguments: /usr/bin/ld --eh-frame-hdr -Bstatic -o clang.f=
ull /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbeginT.o -L/usr/obj/rpi2_cl=
ang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/legacy/usr/lib -L/usr/ob=
j/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/l=
ibz -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/ob=
j-tools/lib/libexecinfo -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-=
src/arm.armv7/tmp/obj-tools/lib/libelf -L/usr/obj/rpi2_clang/arm.armv7/usr/=
fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/ncurses/ncursesw -L/usr/obj/=
rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/lib=
thr -L/usr/lib --gc-sections cc1_main.o cc1as_main.o cc1gen_reproducer_main=
=2Eo driver.o /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv=
7/tmp/obj-tools/lib/clang/libclang/libclang.a /usr/obj/rpi2_clang/arm.armv7=
/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/clang/libllvm/libllvm.a=
 -lz -lexecinfo -lelf -lncursesw -lpthread -legacy -lc++ -lm -lgcc -lgcc_eh=
 -lc -lgcc -lgcc_eh /usr/lib/crtend.o /usr/lib/crtn.o=20
> #0 0x00de160c llvm::sys::PrintStackTrace(llvm::raw_ostream&) /usr/src/con=
trib/llvm-project/llvm/lib/Support/Unix/Signals.inc:572:7
> #1 0x00ddf604 llvm::sys::RunSignalHandlers() /usr/src/contrib/llvm-projec=
t/llvm/lib/Support/Signals.cpp:0:5
> #2 0x00de1f3c SignalHandler(int) /usr/src/contrib/llvm-project/llvm/lib/S=
upport/Unix/Signals.inc:406:1
> #3 0x42021db4 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
> ARM64TODO: fill_fpregs32c++: error: unable to execute command: Abort trap=
 (core dumped)
> c++: error: linker command failed due to signal (use -v to see invocation)
> *** [clang.full] Error code 254
>=20
> make[4]: stopped in /usr/fbsd/stable-12-src/usr.bin/clang/clang
> .ERROR_TARGET=3D'clang.full'
> .ERROR_META_FILE=3D'/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/=
arm.armv7/tmp/obj-tools/usr.bin/clang/clang/clang.full.meta'
> .MAKE.LEVEL=3D'4'
> MAKEFILE=3D''
> .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes =
verbose'
> _ERROR_CMD=3D'c++ -O -pipe -fno-common -mlong-calls -I/usr/obj/rpi2_clang=
/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/clang/libclan=
g -I/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-=
tools/lib/clang/libllvm -I/usr/fbsd/stable-12-src/contrib/llvm-project/clan=
g/include -I/usr/fbsd/stable-12-src/lib/clang/include -I/usr/fbsd/stable-12=
-src/contrib/llvm-project/llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FO=
RMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_VCS_VERSION_INC -DNDEBUG -DLLVM_DE=
FAULT_TARGET_TRIPLE=3D\"armv7-unknown-freebsd12.2-gnueabihf\" -DLLVM_HOST_T=
RIPLE=3D\"armv7-unknown-freebsd12.2\" -DDEFAULT_SYSROOT=3D\"/usr/obj/rpi2_c=
lang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp\" -DLLVM_TARGET_ENABLE_=
ARM -DLLVM_NATIVE_ASMPARSER=3DLLVMInitializeARMAsmParser -DLLVM_NATIVE_ASMP=
RINTER=3DLLVMInitializeARMAsmPrinter -DLLVM_NATIVE_DISASSEMBLER=3DLLVMIniti=
alizeARMDisassembler -DLLVM_NATIVE_TARGET=3DLLVMInitializeARMTarget -DLLVM_=
NATIVE_TARGETINFO=3DLLVMInitializeARMTargetInfo -DLLVM_NATIVE_TARGETMC=3DLL=
VMInitializeARMTargetMC -ffunction-sections -fdata-sections -gline-tables-o=
nly -Wno-format-zero-length -mcpu=3Dcortex-a7 -Qunused-arguments -I/usr/obj=
/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/legacy/usr/inclu=
de -fno-exceptions -fno-rtti -std=3Dc++14 -mcpu=3Dcortex-a7 -stdlib=3Dlibc+=
+ -Wno-c++11-extensions  -Wl,--gc-sections -static  -L/usr/obj/rpi2_clang/a=
rm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/legacy/usr/lib -o clang.full =
 cc1_main.o cc1as_main.o cc1gen_reproducer_main.o driver.o /usr/obj/rpi2_cl=
ang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/clang/libc=
lang/libclang.a /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.ar=
mv7/tmp/obj-tools/lib/clang/libllvm/libllvm.a -L/usr/obj/rpi2_clang/arm.arm=
v7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/libz -lz -L/usr/obj/r=
pi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/libe=
xecinfo -lexecinfo -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/a=
rm.armv7/tmp/obj-tools/lib/libelf -lelf -L/usr/obj/rpi2_clang/arm.armv7/usr=
/fbsd/stable-12-src/arm.armv7/tmp/obj-tools/lib/ncurses/ncursesw -lncursesw=
 -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t=
ools/lib/libthr -lpthread -legacy;'
> .CURDIR=3D'/usr/fbsd/stable-12-src/usr.bin/clang/clang'
> .MAKE=3D'make'
> .OBJDIR=3D'/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7=
/tmp/obj-tools/usr.bin/clang/clang'
> .TARGETS=3D'all'
> DESTDIR=3D''
> LD_LIBRARY_PATH=3D''
> MACHINE=3D'arm'
> MACHINE_ARCH=3D'armv7'
> MAKEOBJDIRPREFIX=3D''
> MAKESYSPATH=3D'/usr/fbsd/stable-12-src/share/mk'
> MAKE_VERSION=3D'20201117'
> PATH=3D'/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tm=
p/legacy/usr/sbin:/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.=
armv7/tmp/legacy/usr/bin:/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-s=
rc/arm.armv7/tmp/legacy/bin:/sbin:/bin:/usr/sbin:/usr/bin'
> SRCTOP=3D'/usr/fbsd/stable-12-src'
> OBJTOP=3D'/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/=
tmp/obj-tools'
> .MAKE.MAKEFILES=3D'/usr/fbsd/stable-12-src/share/mk/sys.mk /usr/fbsd/stab=
le-12-src/share/mk/local.sys.env.mk /usr/fbsd/stable-12-src/share/mk/src.sy=
s.env.mk /root/src.configs/src.conf.armv7-clang-bootstrap.armv7-host /usr/f=
bsd/stable-12-src/share/mk/bsd.mkopt.mk /usr/fbsd/stable-12-src/share/mk/sr=
c.sys.obj.mk /usr/fbsd/stable-12-src/share/mk/auto.obj.mk /usr/fbsd/stable-=
12-src/share/mk/bsd.suffixes.mk /root/src.configs/make.conf /usr/fbsd/stabl=
e-12-src/share/mk/local.sys.mk /usr/fbsd/stable-12-src/share/mk/src.sys.mk =
/dev/null /usr/fbsd/stable-12-src/usr.bin/clang/clang/Makefile /usr/fbsd/st=
able-12-src/share/mk/src.opts.mk /usr/fbsd/stable-12-src/share/mk/bsd.own.m=
k /usr/fbsd/stable-12-src/share/mk/bsd.opts.mk /usr/fbsd/stable-12-src/shar=
e/mk/bsd.cpu.mk /usr/fbsd/stable-12-src/share/mk/bsd.compiler.mk /usr/fbsd/=
stable-12-src/share/mk/bsd.linker.mk /usr/fbsd/stable-12-src/usr.bin/clang/=
clang.prog.mk /usr/fbsd/stable-12-src/lib/clang/clang.pre.mk /usr/fbsd/stab=
le-12-src/lib/clang/llvm.pre.mk /usr/fbsd/stable-12-src/lib/clang/clang.bui=
ld.mk /usr/fbsd/stable-12-src/lib/clang/llvm.build.mk /usr/fbsd/stable-12-s=
rc/tools/build/mk/bsd.prog.mk /usr/fbsd/stable-12-src/share/mk/bsd.prog.mk =
/usr/fbsd/stable-12-src/share/mk/bsd.init.mk /usr/fbsd/stable-12-src/share/=
mk/local.init.mk /usr/fbsd/stable-12-src/share/mk/src.init.mk /usr/fbsd/sta=
ble-12-src/usr.bin/clang/clang/../Makefile.inc /usr/fbsd/stable-12-src/usr.=
bin/clang/clang/../../Makefile.inc /usr/fbsd/stable-12-src/share/mk/bsd.lib=
names.mk /usr/fbsd/stable-12-src/share/mk/src.libnames.mk /usr/fbsd/stable-=
12-src/share/mk/bsd.nls.mk /usr/fbsd/stable-12-src/share/mk/bsd.confs.mk /u=
sr/fbsd/stable-12-src/share/mk/bsd.files.mk /usr/fbsd/stable-12-src/share/m=
k/bsd.dirs.mk /usr/fbsd/stable-12-src/share/mk/bsd.incs.mk /usr/fbsd/stable=
-12-src/share/mk/bsd.links.mk /usr/fbsd/stable-12-src/share/mk/bsd.dep.mk /=
usr/fbsd/stable-12-src/share/mk/bsd.clang-analyze.mk /usr/fbsd/stable-12-sr=
c/share/mk/bsd.obj.mk /usr/fbsd/stable-12-src/share/mk/bsd.subdir.mk /usr/f=
bsd/stable-12-src/share/mk/bsd.sys.mk /usr/fbsd/stable-12-src/tools/build/m=
k/Makefile.boot'
> .PATH=3D'. /usr/fbsd/stable-12-src/usr.bin/clang/clang /usr/fbsd/stable-1=
2-src/contrib/llvm-project/clang/tools/driver'
> 1 error
>=20
> # gdb /usr/bin/ld.lld /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-sr=
c/arm.armv7/tmp/obj-tools/usr.bin/clang/clang/ld.lld.core
> GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
> Copyright (C) 2020 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.h=
tml>
> . . .
> Reading symbols from /usr/bin/ld.lld...
> Reading symbols from /usr/lib/debug//usr/bin/ld.lld.debug...
> [New LWP 100183]
> Core was generated by `/usr/bin/ld --eh-frame-hdr -Bstatic -o clang.full =
/usr/lib/crt1.o /usr/lib/crti.'.
> Program terminated with signal SIGABRT, Aborted.
> #0  thr_kill () at thr_kill.S:4
> 4       thr_kill.S: No such file or directory.
> (gdb) info threads
>   Id   Target Id         Frame=20
> * 1    LWP 100183        thr_kill () at thr_kill.S:4(gdb) info threads
>   Id   Target Id         Frame=20
> * 1    LWP 100183        thr_kill () at thr_kill.S:4
> (gdb) bt
> #0  thr_kill () at thr_kill.S:4
> #1  0x4227d998 in __raise (s=3D6) at /usr/src/lib/libc/gen/raise.c:52
> #2  0x423322c8 in abort () at /usr/src/lib/libc/stdlib/abort.c:79
> #3  0x00da5e4c in report_bad_alloc_error () at /usr/src/contrib/llvm-proj=
ect/llvm/lib/Support/ErrorHandling.cpp:174
> #4  0x00da61c8 in out_of_memory_new_handler() () at /usr/src/contrib/llvm=
-project/llvm/lib/Support/ErrorHandling.cpp:187
> #5  0x420f5d24 in operator new (size=3D<optimized out>) at /usr/src/contr=
ib/llvm-project/libcxx/src/new.cpp:73
> #6  0x004d995c in Allocate () at /usr/src/contrib/llvm-project/llvm/inclu=
de/llvm/Support/AllocatorBase.h:85
> #7  StartNewSlab () at /usr/src/contrib/llvm-project/llvm/include/llvm/Su=
pport/Allocator.h:336
> #8  Allocate () at /usr/src/contrib/llvm-project/llvm/include/llvm/Suppor=
t/Allocator.h:188
> #9  0x00543388 in Allocate () at /usr/src/contrib/llvm-project/llvm/inclu=
de/llvm/Support/Allocator.h:202
> #10 Allocate () at /usr/src/contrib/llvm-project/llvm/include/llvm/Suppor=
t/AllocatorBase.h:46
> #11 Allocate<lld::elf::Defined> () at /usr/src/contrib/llvm-project/llvm/=
include/llvm/Support/AllocatorBase.h:69
> #12 Allocate () at /usr/src/contrib/llvm-project/llvm/include/llvm/Suppor=
t/Allocator.h:427
> #13 make<lld::elf::Defined, lld::elf::ObjFile<llvm::object::ELF32LE> *, l=
ld::elf::StringRefZ &, llvm::ELF::(anonymous enum at /usr/src/contrib/llvm-=
project/llvm/include/llvm/BinaryFormat/ELF.h:1044:1), const unsigned char &=
, unsigned char &, const llvm::support::detail::packed_endian_specific_inte=
gral<unsigned int, llvm::support::little, 1, 1> &, const llvm::support::det=
ail::packed_endian_specific_integral<unsigned int, llvm::support::little, 1=
, 1> &, lld::elf::InputSectionBase *&> () at /usr/src/contrib/llvm-project/=
lld/include/lld/Common/Memory.h:62
> #14 initializeSymbols () at /usr/src/contrib/llvm-project/lld/ELF/InputFi=
les.cpp:1107
> #15 0x0053a008 in parse () at /usr/src/contrib/llvm-project/lld/ELF/Input=
Files.cpp:401
> #16 doParseFile<llvm::object::ELFType<llvm::support::little, false> > () =
at /usr/src/contrib/llvm-project/lld/ELF/InputFiles.cpp:208
> #17 parseFile () at /usr/src/contrib/llvm-project/lld/ELF/InputFiles.cpp:=
215
> #18 0x0053b684 in fetch () at /usr/src/contrib/llvm-project/lld/ELF/Input=
Files.cpp:1212
> #19 0x005fdce8 in addSymbol () at /usr/src/contrib/llvm-project/lld/ELF/S=
ymbolTable.cpp:98
> #20 0x0053b4b4 in parse () at /usr/src/contrib/llvm-project/lld/ELF/Input=
Files.cpp:1184
> #21 0x005143bc in link<llvm::object::ELFType<llvm::support::little, false=
> > () at /usr/src/contrib/llvm-project/lld/ELF/Driver.cpp:1916
> #22 0x0050c864 in main () at /usr/src/contrib/llvm-project/lld/ELF/Driver=
=2Ecpp:539
> #23 0x0050b078 in link () at /usr/src/contrib/llvm-project/lld/ELF/Driver=
=2Ecpp:114
> #24 0x006be290 in main () at /usr/src/contrib/llvm-project/lld/tools/lld/=
lld.cpp:146
>=20
> The size of the slab being allocated and the allocation initiation
> are from #7 above:
>=20
>   /// Allocate a new slab and move the bump pointers over into the new
>   /// slab, modifying CurPtr and End.
>   void StartNewSlab() {
>     size_t AllocatedSlabSize =3D computeSlabSize(Slabs.size());
>=20
>     void *NewSlab =3D
>         Allocator.Allocate(AllocatedSlabSize, alignof(std::max_align_t));
> . . .
>=20
> This code is associated with the class template:
>=20
> /// Allocate memory in an ever growing pool, as if by bump-pointer.
> ///  =20
> /// This isn't strictly a bump-pointer allocator as it uses backing slabs=
 of
> /// memory rather than relying on a boundless contiguous heap. However, i=
t has
> /// bump-pointer semantics in that it is a monotonically growing pool of =
memory
> /// where every allocation is found by merely allocating the next N bytes=
 in
> /// the slab, or the next N bytes in the next slab.
> ///
> /// Note that this also has a threshold for forcing allocations above a c=
ertain
> /// size into their own slab.
> ///
> /// The BumpPtrAllocatorImpl template defaults to using a MallocAllocator
> /// object, which wraps malloc, to allocate memory, but it can be changed=
 to
> /// use a custom allocator.
> ///
> /// The GrowthDelay specifies after how many allocated slabs the allocator
> /// increases the size of the slabs.
> template <typename AllocatorT =3D MallocAllocator, size_t SlabSize =3D 40=
96,
>           size_t SizeThreshold =3D SlabSize, size_t GrowthDelay =3D 128>
> class BumpPtrAllocatorImpl
>     : public AllocatorBase<BumpPtrAllocatorImpl<AllocatorT, SlabSize,
>                                                 SizeThreshold, GrowthDela=
y>> {
> . . .
>=20
> The actual malloc call and the later out_of_memory_new_handler
> call was via #5:
>=20
> // Implement all new and delete operators as weak definitions
> // in this shared library, so that they can be overridden by programs
> // that define non-weak copies of the functions.
>=20
> _LIBCPP_WEAK
> void *
> operator new(std::size_t size) _THROW_BAD_ALLOC
> {
>     if (size =3D=3D 0)
>         size =3D 1;
>     void* p;
>     while ((p =3D ::malloc(size)) =3D=3D 0)
>     {
>         // If malloc fails and there is a new_handler,
>         // call it to try free up memory.
>         std::new_handler nh =3D std::get_new_handler();
>         if (nh)
>             nh();
> . . .
>=20
> malloc really did return NULL.
>=20
> It looks like the allocations simply got to be to
> big in total in process virtual memory space, not
> necessarily in (contiguous) RAM space.
>=20
>=20
> =3D=3D=3D
> Mark Millard
> marklmi at yahoo.com
> ( dsl-only.net went
> away in early 2018-Mar)
>=20
>=20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20201229010220.GA36311>