Re: Troubles building world on stable/13

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 24 Jan 2022 18:26:26 UTC
On 2022-Jan-24, at 08:54, bob prohaska <fbsd@www.zefox.net> wrote:

> On Fri, Jan 21, 2022 at 11:14:32PM -0800, Mark Millard wrote:
>>> On 2022-Jan-20, at 22:00, Mark Millard <marklmi@yahoo.com> wrote:
>>> 
>> 
>> It does no good for me since I do not get a failure,
>> but you might try (instead of exectuing the .sh file)
>> (I used \'s to split the huge line):
>> 
>> lldb -- "/usr/bin/c++" "-cc1" "-triple" "aarch64-unknown-freebsd13.0" "-emit-obj" "--mrelax-relocations" \
>> "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "gmock_main.cc" \
>> "-mrelocation-model" "static" "-mframe-pointer=non-leaf" "-fno-rounding-math" "-mconstructor-aliases" \
>> "-munwind-tables" "-target-cpu" "generic" "-target-feature" "+neon" "-target-abi" "aapcs" \
>> "-fallow-half-arguments-and-returns" "-debug-info-kind=standalone" "-dwarf-version=4" \
>> "-debugger-tuning=gdb" \
>> "-fcoverage-compilation-dir=/usr/obj/usr/src/arm64.aarch64/lib/googletest/gmock_main" \
>> "-O2" "-Wno-format-zero-length" "-Wsystem-headers" "-Werror" "-Wall" "-Wno-format-y2k" "-W" \
>> "-Wno-unused-parameter" "-Wpointer-arith" "-Wreturn-type" "-Wcast-qual" "-Wwrite-strings" "-Wswitch" \
>> "-Wshadow" "-Wunused-parameter" "-Wcast-align" "-Wchar-subscripts" "-Wredundant-decls" \
>> "-Wmissing-variable-declarations" "-Wno-empty-body" "-Wno-string-plus-int" "-Wno-unused-const-variable" \
>> "-Wno-error=unused-but-set-variable" "-Wno-deprecated-declarations" "-Wno-deprecated-copy" \
>> "-Wno-c++11-extensions" "-std=c++11" "-fdeprecated-macro" \
>> "-fdebug-compilation-dir=/usr/obj/usr/src/arm64.aarch64/lib/googletest/gmock_main" \
>> "-ferror-limit" "19" "-stack-protector" "2" "-fno-signed-char" "-fgnuc-version=4.2.1" \
>> "-fcxx-exceptions" "-fexceptions" "-vectorize-loops" "-vectorize-slp" "-faddrsig" \
>> "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "gmock_main-f5c28a.cpp"
>> 
>> and then "run" at the (lldb) prompt. It might stop and let you
>> get a backtrace (bt command) in addition to whatever it reports
>> about the stoppage.
> 
> That seems to have worked, to some extent. Here's the transcript, in single-user mode:
> 
> root@pelorus:/usr/src # 
> root@pelorus:/usr/src # lldb -- "/usr/bin/c++" "-cc1" "-triple" "aarch64-unknown-freebsd13.0" "-emit-obj" "--mrelax-relocations" \
>> . . .
>> "-fcxx-exceptions" "-fexceptions" "-vectorize-loops" "-vectorize-slp" "-faddrsig" \
>> "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "gmock_main-f5c28a.cpp"
> (lldb) target create "/usr/bin/c++"
> 
> Current executable set to '/usr/bin/c++' (aarch64).
> (lldb) settings set -- target.run-args  "-cc1" . . . "c++" "gmock_main-f5c28a.cpp"
> (lldb) 
> (lldb) run
> Process 58516 launched: '/usr/bin/c++' (aarch64)
> Process 58516 stopped
> * thread #1, name = 'c++', stop reason = signal SIGSEGV: invalid address (fault address: 0x1)
>    frame #0: 0x0000000002df7444 c++`::ProcessDeclAttributeList() [inlined] getPointer at PointerIntPair.h:59:58
>   56  	
>   57  	  explicit PointerIntPair(PointerTy PtrVal) { initWithPointer(PtrVal); }
>   58  	
> -> 59  	  PointerTy getPointer() const { return Info::getPointer(Value); }
>   60  	
>   61  	  IntType getInt() const { return (IntType)Info::getInt(Value); }
>   62  	
> (lldb) bt
> * thread #1, name = 'c++', stop reason = signal SIGSEGV: invalid address (fault address: 0x1)
>  * frame #0: 0x0000000002df7444 c++`::ProcessDeclAttributeList() [inlined] getPointer at PointerIntPair.h:59:58
>    frame #1: 0x0000000002df7444 c++`::ProcessDeclAttributeList() [inlined] isNull at PointerUnion.h:172:43
>    frame #2: 0x0000000002df7444 c++`::ProcessDeclAttributeList() [inlined] empty at TinyPtrVector.h:166:13
>    frame #3: 0x0000000002df7444 c++`::ProcessDeclAttributeList() [inlined] empty at ParsedAttr.h:873:40
>    frame #4: 0x0000000002df7444 c++`::ProcessDeclAttributeList() at SemaDeclAttr.cpp:8449:16
>    frame #5: 0x000000000317e784 c++`::ActOnClassTemplateSpecialization() at SemaTemplate.cpp:8537:3
> (lldb) 

To look at the different frames:

(lldb) up 1
(lldb) bt
. . . (output) . . .
(lldb) up 1
(lldb) bt
. . . (output) . . .

and so on until #5 has been displayed.

> [repeated bt commands seem to duplicate the same output]
> 
> I can't make much sense of it, but perhaps others can. It does look
> as if I've somehow corrupted c++. Is there some way to bootstrap
> past the defect? All the clean targets I've tried (clean, cleandir, 
> cleanworld, rm -rf /usr/obj, cleandepend) seem to have no effect,
> singly and in combination. 
> 
> Is it possible to simply delete /usr/src/contrib/llvm-project and 
> let git reconstruct it, then force a compiler rebuild somwhow?

Using git status should report on any files that do not
match what is in .git . In my context for main [so: 14]
that would be:

# git -C /usr/main-src status
. . . (output --if any) . . .

You would likely need /usr/src instead.

Using git diff would show the specific differences. In my
context for main [so: 14] that would look like (if no
differences were found):

# git -C /usr/main-src diff
. . . (output --if any) . . .

You would likely need /usr/src .

If these do not show anything, the source code is not
likely to be the problem.

===
Mark Millard
marklmi at yahoo.com