Re: lang/gcc and llvm 15 (was: Re: amd64-clang bulk build report (llvm 15))

2023-01-11 Thread Pascal Stumpf
On Tue, 10 Jan 2023 18:40:19 +0100, Jeremie Courreges-Anglas wrote:

[...]

> (Note that the two "lazy binding failed" error messages were produced
> with a tweaked ld.so to print the symbol name.)
> 
> Below is the diff I used to work around the breakage on amd64. The last
> part of the diff (lang/gcc/8/patches/patch-gcc_genconditions_c) could be
> committed right away I think. ok?

OK for this one.

> I'm not looking for oks for the rest of the diff, but rather for help in
> understanding and fixing the issue at hand.

I'm still trying to figure out the xonly breakage, but I'll get back to
this asap.

> llvm 15 test material: git branch:
> https://github.com/jcourreges/openbsd-src/tree/llvm15-6 amd64 snaps:
> https://pbuild-amd64.wxcvbn.org/pub/OpenBSD/snapshots/amd64/
> 
> 
> Index: lang/gcc/11/Makefile
> === RCS
> file: /home/cvs/ports/lang/gcc/11/Makefile,v retrieving revision 1.16
> diff -u -p -r1.16 Makefile --- lang/gcc/11/Makefile 22 Nov 2022 23:26:10
> - 1.16 +++ lang/gcc/11/Makefile 2 Jan 2023 20:22:15 - @@ -11,6
> +11,9 @@ ONLY_FOR_ARCHS = aarch64 alpha amd64 arm ONLY_FOR_ARCHS-ada =
> amd64 i386 mips64 powerpc ONLY_FOR_ARCHS-dlang = aarch64 amd64 arm i386
> powerpc powerpc64
> 
> +# XXX lld 15 can't link internal tools like genpreds +USE_LLD = No +
> DPB_PROPERTIES = parallel
> 
>  V = 11.2.0 @@ -130,7 +133,6 @@ MAKE_ENV += ${EXTRA_ENV}
> # powerpc lld can't link C++ code from gcc, "ld: error:
> relocation # refers to a discarded section:" .data.rel.ro.* or #
> .sdata.DW.ref.__gxx_personality_v0 -USE_LLD = No CONFIGURE_ENV +=
> LDFLAGS="-Wl,--relax" .endif
> 
> Index: lang/gcc/8/Makefile
> ===
> RCS file: /home/cvs/ports/lang/gcc/8/Makefile,v retrieving revision
> 1.61 diff -u -p -r1.61 Makefile --- lang/gcc/8/Makefile 18 Dec 2022
> 16:19:26 - 1.61 +++ lang/gcc/8/Makefile 2 Jan 2023 20:21:46 - @@
> -4,12 +4,8 @@ ONLY_FOR_ARCHS = aarch64 alpha amd64 arm # XXX: sparc64
> ONLY_FOR_ARCHS-ada = amd64 hppa i386 mips64 powerpc
> 
> -# powerpc lld can't link C++ code from gcc, "ld: error:
> relocation -# refers to a discarded section:" .data.rel.ro.* or -#
> .sdata.DW.ref.__gxx_personality_v0 -.if ${MACHINE_ARCH:Mpowerpc} +# XXX
> lld 15 can't link internal tools such as genpreds USE_LLD = No -.endif
> 
>  DPB_PROPERTIES = parallel
> 
> Index: lang/gcc/8/patches/patch-gcc_genconditions_c
> === RCS
> file: /home/cvs/ports/lang/gcc/8/patches/patch-gcc_genconditions_c,v
> retrieving revision 1.2 diff -u -p -r1.2 patch-gcc_genconditions_c
> --- lang/gcc/8/patches/patch-gcc_genconditions_c 11 Mar 2022 19:28:59
> - 1.2 +++ lang/gcc/8/patches/patch-gcc_genconditions_c 2 Jan 2023
> 20:21:11 - @@ -6,7 +6,7 @@ Index: gcc/genconditions.c in a generator
> program. As a defensive measure, don't do so when the\n\ table isn't
> going to have anything in it. */\n\ -#if GCC_VERSION >= 3001\n\ -+#if
> GCC_VERSION >= 3001 && __clang_major__ != 13\n\ ++#if GCC_VERSION >=
> 3001 && !defined(__clang_major__)\n\ \n\ /* Do not allow checking to
> confuse the issue. */\n\ #undef CHECKING_P\n\ @@ -15,7 +15,7 @@ Index:
> gcc/genconditions.c optimizing. */\n\ \n\ -#if GCC_VERSION >= 3001\n\
> -+#if GCC_VERSION >= 3001 && __clang_major__ != 13\n\ ++#if GCC_VERSION
> >= 3001 && !defined(__clang_major__)\n\ static const struct c_test
> insn_conditions[] = {\n");
> 
> traverse_c_tests (write_one_condition, 0); @@ -24,7 +24,7 @@ Index:
> gcc/genconditions.c " const char *p;\n" " puts (\"(define_conditions
> [\");\n" - "#if GCC_VERSION >= 3001\n" -+ "#if GCC_VERSION >=
> 3001 && __clang_major__ != 13\n" ++ "#if GCC_VERSION >= 3001
> && !defined(__clang_major__)\n" " for (i = 0; i < ARRAY_SIZE
> (insn_conditions); i++)\n" " {\n" " printf (\" (%d \\\"\",
> insn_conditions[i].value);\n"
> 
> 
> -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524
> E7EE
> 
>>> application/pgp-signature attachment



lang/gcc and llvm 15 (was: Re: amd64-clang bulk build report (llvm 15))

2023-01-10 Thread Jeremie Courreges-Anglas
On Sun, Jan 08 2023, Jeremie Courreges-Anglas  wrote:
> Hi,
>
> On Sun, Jan 08 2023, Jérémie Courrèges-Anglas  wrote:
>> Bulk build on pbuild-amd64.wxcvbn.org
>>
>> Started : Tue Jan  3 02:26:11 CET 2023
>> Finished: Sat Jan  7 01:45:02 CET 2023
>> Duration: 3 Days 23 hours 19 minutes
>>
>> Built using OpenBSD 7.2-current (GENERIC.MP) #2: Fri Dec 30 02:11:28 CET 2022
>>
>> Built 10508 packages
>>
>> Number of packages built each day:
>> Jan 3: 3984
>> Jan 4: 1693
>> Jan 5: 1731
>> Jan 6: 3094
>> Jan 7: 6
>>
>>
>> Critical path missing pkgs:
>> https://wxcvbn.org/~jca/build-failures/amd64-clang/2023-01-03/summary.txt
>>
>> Build failures: 132
>
> Here's the results of a test bulk build using llvm 15 in base and ports
> on amd64.  Since a lot of the tree was taken out by a few ports
> I patched some of them.  Summary below, wip diff at the end of this
> mail.
>
> | port   | change summary 
>|
> ++---+
> | devel/jdk/11   | avoid -Werror  
>|
> | devel/libinotify/patches/patch-Makefile_am | drop -Werror   
>|
> | devel/llvm | update to llvm 15  
>|
> | lang/clang/clang.port.mk   | update to llvm 15  
>|
> | lang/gcc/11| fix with llvm 15 (lld) 
>|
> | lang/gcc/8 | fix with llvm 15 (clang + ldd) 
>|


Both lang/gcc/8 and lang/gcc/11 seem to have a problem with ld.lld,
whether I disable ada or not.  Switching to ld.bfd fixes the builds but
is not a very workable solution.

lang/gcc/11 with ada and ld.lld
cp -p /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/ada/sinfo.ads 
/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/ada/sinfo.adb 
/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/ada/xsinfo.adb 
/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/ada/csinfo.adb ada/bldtools/sinfo
(cd ada/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h )
touch ada/GNAT_DATE
mkdir -p ada/libgnat
cp -p /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/ada/libgnat/s-excmac__gcc.ads 
ada/libgnat/s-excmac.ads
mkdir -p ada/libgnat
cp -p /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/ada/libgnat/s-excmac__gcc.adb 
ada/libgnat/s-excmac.adb
echo "pragma Style_Checks (Off);" >tmp-sdefault.adb

Check for field name consistency
 OK

Check for function consistency
 OK

Check for missing functions
 OK

Check for set procedure consistency
 OK

Check for missing set procedures
 OK

Check pragma Inlines are all for existing subprograms
 OK

Check no pragma Inlines were omitted
 OK

Check references in functions in body
 OK

Check for missing functions in body
 OK

Check Set procedures in body
 OK

Check for missing set procedures in body
 OK

All tests completed successfully, no errors detected
echo "with Osint; use Osint;" >>tmp-sdefault.adb
echo "package body Sdefault is" >>tmp-sdefault.adb
echo "   S0 : constant String := \"/usr/local/\";" >>tmp-sdefault.adb
echo "   S1 : constant String := 
\"/usr/local/lib/gcc/x86_64-unknown-openbsd7.2/11.2.0/adainclude/\";" 
>>tmp-sdefault.adb
echo "   S2 : constant String := 
\"/usr/local/lib/gcc/x86_64-unknown-openbsd7.2/11.2.0/adalib/\";" 
>>tmp-sdefault.adb
echo "   S3 : constant String := \"x86_64-unknown-openbsd7.2/\";" 
>>tmp-sdefault.adb
echo "   S4 : constant String := 
\"/usr/local/lib/gcc/x86_64-unknown-openbsd7.2/11.2.0/\";" >>tmp-sdefault.adb
echo "   function Include_Dir_Default_Name return String_Ptr is" 
>>tmp-sdefault.adb
echo "   begin" >>tmp-sdefault.adb
echo "  return Relocate_Path (S0, S1);" >>tmp-sdefault.adb
echo "   end Include_Dir_Default_Name;" >>tmp-sdefault.adb
echo "   function Object_Dir_Default_Name return String_Ptr is" 
>>tmp-sdefault.adb
echo "   begin" >>tmp-sdefault.adb
echo "  return Relocate_Path (S0, S2);" >>tmp-sdefault.adb
echo "   end Object_Dir_Default_Name;" >>tmp-sdefault.adb
echo "   function Target_Name return String_Ptr is" >>tmp-sdefault.adb
echo "   begin" >>tmp-sdefault.adb
echo "  return new String'(S3);" >>tmp-sdefault.adb
echo "   end Target_Name;" >>tmp-sdefault.adb
echo "   function Search_Dir_Prefix return String_Ptr is" >>tmp-sdefault.adb
echo "   begin" >>tmp-sdefault.adb
echo "  return Relocate_Path (S0, S4);" >>tmp-sdefault.adb
echo "   end Search_Dir_Prefix;" >>tmp-sdefault.adb
echo "end Sdefault;" >> tmp-sdefault.adb
mv -f tmp-sdefault.adb ada/sdefault.adb
touch ada/stamp-sdefault
cp /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/gcc-ar.c gcc-nm.c
cp /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/gcc-ar.c gcc-ranlib.c
rm -f mm_malloc.h
cat /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/config/i386/gmm_malloc.h > 
mm_malloc.h