Date: Mon, 28 Dec 2020 16:46:38 -0800 From: Mark Millard <marklmi@yahoo.com> To: bob prohaska <fbsd@www.zefox.net> Cc: freebsd-arm <freebsd-arm@freebsd.org> Subject: Re: Migrating from -current to stable/12 on RPI2B (ARMv7) Message-ID: <F8CD90C5-0B20-4446-806A-DAD4BA4DCA4D@yahoo.com> 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 2020-Dec-28, at 16:14, Mark Millard <marklmi at yahoo.com> wrote: > [I get the problem as well! I report a backtrace of the failure > and some more.] >=20 > 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_COMPILER: libclang will be built for bootstrapping a = cross-compiler. >> make[1]: "/usr/fbsd/stable-12-src/Makefile.inc1" line 349: = SYSTEM_LINKER: 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.armv7/tmp/obj-too= ls/usr.bin/clang/clang...] > Building = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/usr.bin/clang/clang/cc1_main.o > Building = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/usr.bin/clang/clang/cc1as_main.o > Building = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/usr.bin/clang/clang/cc1gen_reproducer_main.o > Building = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/usr.bin/clang/clang/driver.o > Building = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/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 = include the crash backtrace. > Stack dump: > 0. Program arguments: /usr/bin/ld --eh-frame-hdr -Bstatic -o = clang.full /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbeginT.o = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/legac= y/usr/lib = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libz = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libexecinfo = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libelf = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/ncurses/ncursesw = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libthr -L/usr/lib --gc-sections cc1_main.o cc1as_main.o = cc1gen_reproducer_main.o driver.o = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/lib/clang/libclang/libclang.a = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/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/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:572:7 > #1 0x00ddf604 llvm::sys::RunSignalHandlers() = /usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:0:5 > #2 0x00de1f3c SignalHandler(int) = /usr/src/contrib/llvm-project/llvm/lib/Support/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/a= rm.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-t= ools/lib/clang/libclang = -I/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/clang/libllvm = -I/usr/fbsd/stable-12-src/contrib/llvm-project/clang/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_FORMAT_MACROS -D__STDC_LIMIT_MACROS = -DHAVE_VCS_VERSION_INC -DNDEBUG = -DLLVM_DEFAULT_TARGET_TRIPLE=3D\"armv7-unknown-freebsd12.2-gnueabihf\" = -DLLVM_HOST_TRIPLE=3D\"armv7-unknown-freebsd12.2\" = -DDEFAULT_SYSROOT=3D\"/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src= /arm.armv7/tmp\" -DLLVM_TARGET_ENABLE_ARM = -DLLVM_NATIVE_ASMPARSER=3DLLVMInitializeARMAsmParser = -DLLVM_NATIVE_ASMPRINTER=3DLLVMInitializeARMAsmPrinter = -DLLVM_NATIVE_DISASSEMBLER=3DLLVMInitializeARMDisassembler = -DLLVM_NATIVE_TARGET=3DLLVMInitializeARMTarget = -DLLVM_NATIVE_TARGETINFO=3DLLVMInitializeARMTargetInfo = -DLLVM_NATIVE_TARGETMC=3DLLVMInitializeARMTargetMC -ffunction-sections = -fdata-sections -gline-tables-only -Wno-format-zero-length = -mcpu=3Dcortex-a7 -Qunused-arguments = -I/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/legac= y/usr/include -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/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/legac= y/usr/lib -o clang.full cc1_main.o cc1as_main.o = cc1gen_reproducer_main.o driver.o = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/lib/clang/libclang/libclang.a = /usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-too= ls/lib/clang/libllvm/libllvm.a = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libz -lz = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libexecinfo -lexecinfo = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/lib/libelf -lelf = -L/usr/obj/rpi2_clang/arm.armv7/usr/fbsd/stable-12-src/arm.armv7/tmp/obj-t= ools/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/tmp= /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-= src/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/t= mp/obj-tools' > .MAKE.MAKEFILES=3D'/usr/fbsd/stable-12-src/share/mk/sys.mk = /usr/fbsd/stable-12-src/share/mk/local.sys.env.mk = /usr/fbsd/stable-12-src/share/mk/src.sys.env.mk = /root/src.configs/src.conf.armv7-clang-bootstrap.armv7-host = /usr/fbsd/stable-12-src/share/mk/bsd.mkopt.mk = /usr/fbsd/stable-12-src/share/mk/src.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/stable-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/stable-12-src/share/mk/src.opts.mk = /usr/fbsd/stable-12-src/share/mk/bsd.own.mk = /usr/fbsd/stable-12-src/share/mk/bsd.opts.mk = /usr/fbsd/stable-12-src/share/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/stable-12-src/lib/clang/llvm.pre.mk = /usr/fbsd/stable-12-src/lib/clang/clang.build.mk = /usr/fbsd/stable-12-src/lib/clang/llvm.build.mk = /usr/fbsd/stable-12-src/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/stable-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.libnames.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 = /usr/fbsd/stable-12-src/share/mk/bsd.files.mk = /usr/fbsd/stable-12-src/share/mk/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-src/share/mk/bsd.obj.mk = /usr/fbsd/stable-12-src/share/mk/bsd.subdir.mk = /usr/fbsd/stable-12-src/share/mk/bsd.sys.mk = /usr/fbsd/stable-12-src/tools/build/mk/Makefile.boot' > .PATH=3D'. /usr/fbsd/stable-12-src/usr.bin/clang/clang = /usr/fbsd/stable-12-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-src/arm.armv7/tmp/obj-too= ls/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.html> > . . . > 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-project/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/contrib/llvm-project/libcxx/src/new.cpp:73 > #6 0x004d995c in Allocate () at = /usr/src/contrib/llvm-project/llvm/include/llvm/Support/AllocatorBase.h:85= > #7 StartNewSlab () at = /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Allocator.h:336 > #8 Allocate () at = /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Allocator.h:188 > #9 0x00543388 in Allocate () at = /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Allocator.h:202 > #10 Allocate () at = /usr/src/contrib/llvm-project/llvm/include/llvm/Support/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/Support/Allocator.h:427 > #13 make<lld::elf::Defined, lld::elf::ObjFile<llvm::object::ELF32LE> = *, lld::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_integral<unsigned int, = llvm::support::little, 1, 1> &, const = llvm::support::detail::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/InputFiles.cpp:1107 > #15 0x0053a008 in parse () at = /usr/src/contrib/llvm-project/lld/ELF/InputFiles.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/InputFiles.cpp:1212 > #19 0x005fdce8 in addSymbol () at = /usr/src/contrib/llvm-project/lld/ELF/SymbolTable.cpp:98 > #20 0x0053b4b4 in parse () at = /usr/src/contrib/llvm-project/lld/ELF/InputFiles.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.cpp:539 > #23 0x0050b078 in link () at = /usr/src/contrib/llvm-project/lld/ELF/Driver.cpp: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, it 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 certain > /// 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 = 4096, > size_t SizeThreshold =3D SlabSize, size_t GrowthDelay =3D = 128> > class BumpPtrAllocatorImpl > : public AllocatorBase<BumpPtrAllocatorImpl<AllocatorT, SlabSize, > SizeThreshold, = GrowthDelay>> { > . . . >=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. Analyzing the assembler and the gdb-reported register values for #5 leads me to conclude that the size requested was in r4 and was: r4 0x80000 524288 in the code (after +8): 0x420f5ce4 <+0>: push {r4, r5, r11, lr} 0x420f5ce8 <+4>: add r11, sp, #8 0x420f5cec <+8>: mov r4, r0 0x420f5cf0 <+12>: cmp r0, #0 0x420f5cf4 <+16>: movweq r4, #1 0x420f5cf8 <+20>: mov r0, r4 0x420f5cfc <+24>: bl 0x42102070 0x420f5d00 <+28>: cmp r0, #0 0x420f5d04 <+32>: popne {r4, r5, r11, pc} 0x420f5d08 <+36>: ldr r5, [pc, #76] ; 0x420f5d5c = <_Znwj+120> 0x420f5d0c <+40>: add r5, pc, r5 0x420f5d10 <+44>: ldr r0, [r5] 0x420f5d14 <+48>: dmb ish 0x420f5d18 <+52>: cmp r0, #0 0x420f5d1c <+56>: beq 0x420f5d38 <_Znwj+84> 0x420f5d20 <+60>: blx r0 =3D> 0x420f5d24 <+64>: mov r0, r4 0x420f5d28 <+68>: bl 0x42102070 0x420f5d2c <+72>: cmp r0, #0 0x420f5d30 <+76>: beq 0x420f5d10 <_Znwj+44> 0x420f5d34 <+80>: pop {r4, r5, r11, pc} 0x420f5d38 <+84>: mov r0, #4 0x420f5d3c <+88>: bl 0x42102260 0x420f5d40 <+92>: bl 0x42103390 0x420f5d44 <+96>: ldr r1, [pc, #20] ; 0x420f5d60 = <_Znwj+124> 0x420f5d48 <+100>: ldr r1, [pc, r1] 0x420f5d4c <+104>: ldr r2, [pc, #16] ; 0x420f5d64 = <_Znwj+128> 0x420f5d50 <+108>: ldr r2, [pc, r2] 0x420f5d54 <+112>: mov lr, pc 0x420f5d58 <+116>: b 0x42102270 0x420f5d5c <+120>: ldrdeq r5, [r3], -r0 0x420f5d60 <+124>: andeq r0, r2, r4, lsr #32 0x420f5d64 <+128>: andeq r0, r2, r0, lsr #32 =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F8CD90C5-0B20-4446-806A-DAD4BA4DCA4D>