Thanks for the report.

Here a diff which allows to build both: lang/bootgcc and lang/gcc/16;
you need some patches for both gcc, yeah.

Index: lang/bootgcc/patches/patch-gcc_config_pa_pa-openbsd_h
===================================================================
RCS file: /cvs/ports/lang/bootgcc/patches/patch-gcc_config_pa_pa-openbsd_h,v
diff -u -p -r1.3 patch-gcc_config_pa_pa-openbsd_h
--- lang/bootgcc/patches/patch-gcc_config_pa_pa-openbsd_h       25 Oct 2026 
12:56:34 -0000      1.3
+++ lang/bootgcc/patches/patch-gcc_config_pa_pa-openbsd_h       7 Nov 2026 
17:22:59 -0000
@@ -6,7 +6,16 @@ Update OpenBSD-specific configuration on
 Index: gcc/config/pa/pa-openbsd.h
 --- gcc/config/pa/pa-openbsd.h.orig
 +++ gcc/config/pa/pa-openbsd.h
-@@ -138,17 +138,31 @@ along with GCC; see the file COPYING3.  If not see
+@@ -53,7 +53,7 @@ along with GCC; see the file COPYING3.  If not see
+ 
+ #undef ASM_OUTPUT_ADDR_DIFF_ELT
+ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+-  fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
++  fprintf (FILE, "\t.word .L%d+(.+8-.L%d)-$PIC_pcrel$0\n", VALUE, REL)
+ 
+ /* Use the default.  */
+ #undef ASM_OUTPUT_LABEL
+@@ -138,17 +138,34 @@ along with GCC; see the file COPYING3.  If not see
     %{shared:-shared} %{R*} \
     %{static:-Bstatic} \
     %{!static:-Bdynamic} \
@@ -42,3 +51,6 @@ Index: gcc/config/pa/pa-openbsd.h
 +
 +#undef JUMP_TABLES_IN_TEXT_SECTION
 +#define JUMP_TABLES_IN_TEXT_SECTION 0
++
++#undef ASM_OUTPUT_ADDR_VEC
++#undef ASM_OUTPUT_ADDR_DIFF_VEC
Index: lang/bootgcc/patches/patch-gcc_config_pa_pa_md
===================================================================
RCS file: lang/bootgcc/patches/patch-gcc_config_pa_pa_md
diff -N lang/bootgcc/patches/patch-gcc_config_pa_pa_md
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lang/bootgcc/patches/patch-gcc_config_pa_pa_md      7 Nov 2026 17:22:59 
-0000
@@ -0,0 +1,49 @@
+Index: gcc/config/pa/pa.md
+--- gcc/config/pa/pa.md.orig
++++ gcc/config/pa/pa.md
+@@ -7001,8 +7001,10 @@
+ 
+   if (TARGET_64BIT)
+     emit_jump_insn (gen_casesi64p (operands[0], operands[3]));
+-  else if (flag_pic)
++  else if (flag_pic && JUMP_TABLES_IN_TEXT_SECTION)
+     emit_jump_insn (gen_casesi32p (operands[0], operands[3]));
++  else if (flag_pic)
++    emit_jump_insn (gen_casesi32p_rodata (operands[0], operands[3]));
+   else
+     emit_jump_insn (gen_casesi32 (operands[0], operands[3]));
+   DONE;
+@@ -7028,7 +7030,7 @@
+                      (label_ref (match_operand 1 "" "")))))
+    (clobber (match_scratch:SI 2 "=&r"))
+    (clobber (match_scratch:SI 3 "=&r"))]
+-  "flag_pic"
++  "flag_pic && JUMP_TABLES_IN_TEXT_SECTION"
+   "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;ldo {%l1-.|%l1+4-.}(%2),%2\;\
+ {ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
+   [(set_attr "type" "multi")
+@@ -7036,6 +7038,24 @@
+      (if_then_else (match_test "TARGET_PA_20")
+       (const_int 20)
+       (const_int 24)))])
++
++(define_insn "casesi32p_rodata"
++  [(set (pc) (mem:SI (plus:SI
++                     (mult:SI (match_operand:SI 0 "register_operand" "r")
++                              (const_int 4))
++                     (label_ref (match_operand 1 "" "")))))
++   (clobber (match_scratch:SI 2 "=&a"))
++   (clobber (match_scratch:SI 3 "=&r"))]
++  "flag_pic && !JUMP_TABLES_IN_TEXT_SECTION"
++  "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;\
++addil L'%l1-$PIC_pcrel$0+{8|12},%2\;\
++ldo R'%l1-$PIC_pcrel$0+{12|16}(%2),%2\;\
++{ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
++  [(set_attr "type" "multi")
++   (set (attr "length")
++     (if_then_else (match_test "TARGET_PA_20")
++      (const_int 24)
++      (const_int 28)))])
+ 
+ ;;; 64-bit code, 32-bit relative branch table.
+ (define_insn "casesi64p"
Index: lang/bootgcc/patches/patch-gcc_configure
===================================================================
RCS file: /cvs/ports/lang/bootgcc/patches/patch-gcc_configure,v
diff -u -p -r1.2 patch-gcc_configure
--- lang/bootgcc/patches/patch-gcc_configure    11 Mar 2022 19:28:50 -0000      
1.2
+++ lang/bootgcc/patches/patch-gcc_configure    7 Nov 2026 17:22:59 -0000
@@ -19,7 +19,39 @@ Index: gcc/configure
    shlibpath_var=LD_LIBRARY_PATH
    if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test 
"$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
      case $host_os in
-@@ -28864,7 +28864,7 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" 
+@@ -23635,7 +23635,14 @@ else
+   then gcc_cv_as_comdat_group=yes
+ fi
+   elif test x$gcc_cv_as != x; then
+-    $as_echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s
++    case "$target" in
++      hppa*-*-openbsd*)
++        $as_echo '    .section .text,"axG",@progbits,.foo,comdat' > conftest.s
++        ;;
++      *)
++        $as_echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s
++        ;;
++    esac
+     if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o 
conftest.s >&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+@@ -23671,7 +23678,14 @@ else
+   then gcc_cv_as_comdat_group_percent=yes
+ fi
+   elif test x$gcc_cv_as != x; then
+-    $as_echo '.section .text,"axG",%progbits,.foo,comdat' > conftest.s
++    case "$target" in
++      hppa*-*-openbsd*)
++        $as_echo '    .section .text,"axG",%progbits,.foo,comdat' > conftest.s
++        ;;
++      *)
++        $as_echo '.section .text,"axG",%progbits,.foo,comdat' > conftest.s
++        ;;
++    esac
+     if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o 
conftest.s >&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+@@ -28864,7 +28878,7 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" 
  esac
  
  case "$target:$tm_file" in
@@ -28,7 +60,7 @@ Index: gcc/configure
    case "$target" in
       *le-*-linux*)
       emul_name="-melf64lppc"
-@@ -28875,6 +28875,10 @@ case "$target:$tm_file" in
+@@ -28875,6 +28889,10 @@ case "$target:$tm_file" in
       *-*-freebsd*)
       emul_name="-melf64ppc_fbsd"
        ;;
@@ -39,7 +71,7 @@ Index: gcc/configure
    esac
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker support for 
omitting dot symbols" >&5
  $as_echo_n "checking linker support for omitting dot symbols... " >&6; }
-@@ -29242,6 +29246,7 @@ else
+@@ -29242,6 +29260,7 @@ else
  fi
  
          ;;
@@ -47,7 +79,7 @@ Index: gcc/configure
         *) gcc_cv_libc_provides_ssp=no ;;
      esac
    fi
-@@ -29262,6 +29267,7 @@ if test "${enable_default_ssp+set}" = set; then :
+@@ -29262,6 +29281,7 @@ if test "${enable_default_ssp+set}" = set; then :
  if test x$gcc_cv_libc_provides_ssp = xyes; then
    case "$target" in
      ia64*-*-*) enable_default_ssp=no ;;
Index: lang/gcc/16/Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/16/Makefile,v
diff -u -p -r1.48 Makefile
--- lang/gcc/16/Makefile        6 Nov 2026 08:11:35 -0000       1.48
+++ lang/gcc/16/Makefile        7 Nov 2026 17:22:59 -0000
@@ -67,9 +64,10 @@ EXTRACT_ONLY =       ${DISTFILES}
 BUILD_DEPENDS +=       devel/bison
 
 .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \
-    ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "i386" || \
-    ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" || \
-    ${MACHINE_ARCH} == "riscv64" || ${MACHINE_ARCH} == "sparc64"
+    ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "hppa" || \
+    ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
+    ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "riscv64" || \
+    ${MACHINE_ARCH} == "sparc64"
 BUILD_DEPENDS +=       devel/gas
 RUN_DEPENDS +=         devel/gas
 RUN_DEPENDS-main +=    devel/gas
Index: lang/gcc/16/patches/patch-gcc_config_pa_pa-openbsd_h
===================================================================
RCS file: /cvs/ports/lang/gcc/16/patches/patch-gcc_config_pa_pa-openbsd_h,v
diff -u -p -r1.1.1.1 patch-gcc_config_pa_pa-openbsd_h
--- lang/gcc/16/patches/patch-gcc_config_pa_pa-openbsd_h        2 Jun 2026 
20:00:17 -0000       1.1.1.1
+++ lang/gcc/16/patches/patch-gcc_config_pa_pa-openbsd_h        7 Nov 2026 
17:22:59 -0000
@@ -1,7 +1,16 @@
 Index: gcc/config/pa/pa-openbsd.h
 --- gcc/config/pa/pa-openbsd.h.orig
 +++ gcc/config/pa/pa-openbsd.h
-@@ -138,14 +138,15 @@ along with GCC; see the file COPYING3.  If not see
+@@ -53,7 +53,7 @@ along with GCC; see the file COPYING3.  If not see
+ 
+ #undef ASM_OUTPUT_ADDR_DIFF_ELT
+ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+-  fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL)
++  fprintf (FILE, "\t.word .L%d+(.+8-.L%d)-$PIC_pcrel$0\n", VALUE, REL)
+ 
+ /* Use the default.  */
+ #undef ASM_OUTPUT_LABEL
+@@ -138,17 +138,30 @@ along with GCC; see the file COPYING3.  If not see
     %{shared:-shared} %{R*} \
     %{static:-Bstatic} \
     %{!static:-Bdynamic} \
@@ -21,3 +30,18 @@ Index: gcc/config/pa/pa-openbsd.h
  #undef ENDFILE_SPEC
  #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
  
++/* OpenBSD does not use export stubs, so the return pointer can be used
++   without reading the instruction stream.  */
++#undef RETURN_ADDR_RTX
++#define RETURN_ADDR_RTX(COUNT, FRAMEADDR)                             \
++  ((COUNT) == 0 ? get_hard_reg_initial_val (Pmode, 2) : NULL_RTX)
++
+ #define OBSD_HAS_CORRECT_SPECS
+ 
+ #define HAVE_ENABLE_EXECUTE_STACK
++
++#undef JUMP_TABLES_IN_TEXT_SECTION
++#define JUMP_TABLES_IN_TEXT_SECTION 0
++
++#undef ASM_OUTPUT_ADDR_VEC
++#undef ASM_OUTPUT_ADDR_DIFF_VEC
Index: lang/gcc/16/patches/patch-gcc_config_pa_pa_md
===================================================================
RCS file: lang/gcc/16/patches/patch-gcc_config_pa_pa_md
diff -N lang/gcc/16/patches/patch-gcc_config_pa_pa_md
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lang/gcc/16/patches/patch-gcc_config_pa_pa_md       7 Nov 2026 17:22:59 
-0000
@@ -0,0 +1,49 @@
+Index: gcc/config/pa/pa.md
+--- gcc/config/pa/pa.md.orig
++++ gcc/config/pa/pa.md
+@@ -7450,8 +7450,10 @@
+ 
+   if (TARGET_64BIT)
+     emit_jump_insn (gen_casesi64p (operands[0], operands[3]));
+-  else if (flag_pic)
++  else if (flag_pic && JUMP_TABLES_IN_TEXT_SECTION)
+     emit_jump_insn (gen_casesi32p (operands[0], operands[3]));
++  else if (flag_pic)
++    emit_jump_insn (gen_casesi32p_rodata (operands[0], operands[3]));
+   else
+     emit_jump_insn (gen_casesi32 (operands[0], operands[3]));
+   DONE;
+@@ -7477,7 +7479,7 @@
+                      (label_ref (match_operand 1 "" "")))))
+    (clobber (match_scratch:SI 2 "=&r"))
+    (clobber (match_scratch:SI 3 "=&r"))]
+-  "flag_pic"
++  "flag_pic && JUMP_TABLES_IN_TEXT_SECTION"
+   "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;ldo {%l1-.|%l1+4-.}(%2),%2\;\
+ {ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
+   [(set_attr "type" "multi")
+@@ -7485,6 +7487,24 @@
+      (if_then_else (match_test "TARGET_PA_20")
+       (const_int 20)
+       (const_int 24)))])
++
++(define_insn "casesi32p_rodata"
++  [(set (pc) (mem:SI (plus:SI
++                     (mult:SI (match_operand:SI 0 "register_operand" "r")
++                              (const_int 4))
++                     (label_ref (match_operand 1 "" "")))))
++   (clobber (match_scratch:SI 2 "=&a"))
++   (clobber (match_scratch:SI 3 "=&r"))]
++  "flag_pic && !JUMP_TABLES_IN_TEXT_SECTION"
++  "{bl .+8,%2\;depi 0,31,2,%2|mfia %2}\;\
++addil L'%l1-$PIC_pcrel$0+{8|12},%2\;\
++ldo R'%l1-$PIC_pcrel$0+{12|16}(%2),%2\;\
++{ldwx|ldw},s %0(%2),%3\;{addl|add,l} %2,%3,%3\;bv,n %%r0(%3)"
++  [(set_attr "type" "multi")
++   (set (attr "length")
++     (if_then_else (match_test "TARGET_PA_20")
++      (const_int 24)
++      (const_int 28)))])
+ 
+ ;;; 64-bit code, 32-bit relative branch table.
+ (define_insn "casesi64p"
Index: lang/gcc/16/patches/patch-gcc_configure
===================================================================
RCS file: /cvs/ports/lang/gcc/16/patches/patch-gcc_configure,v
diff -u -p -r1.2 patch-gcc_configure
--- lang/gcc/16/patches/patch-gcc_configure     9 Oct 2026 22:37:51 -0000       
1.2
+++ lang/gcc/16/patches/patch-gcc_configure     7 Nov 2026 17:22:59 -0000
@@ -19,7 +19,39 @@ Index: gcc/configure
    shlibpath_var=LD_LIBRARY_PATH
    if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test 
"$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
      case $host_os in
-@@ -33389,7 +33389,7 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" 
+@@ -27778,7 +27778,14 @@
+ else
+   gcc_cv_as_comdat_group=no
+   if test x"$gcc_cv_as" != x; then
+-    $as_echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s
++    case "$target" in
++      hppa*-*-openbsd*)
++        $as_echo '    .section .text,"axG",@progbits,.foo,comdat' > conftest.s
++        ;;
++      *)
++        $as_echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s
++        ;;
++    esac
+     if { ac_try='$gcc_cv_as $gcc_cv_as_flags $fw_as_opt -o conftest.o 
conftest.s >&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+@@ -27809,7 +27816,14 @@
+ else
+   gcc_cv_as_comdat_group_percent=no
+   if test x"$gcc_cv_as" != x; then
+-    $as_echo '.section .text,"axG",%progbits,.foo,comdat' > conftest.s
++    case "$target" in
++      hppa*-*-openbsd*)
++        $as_echo '    .section .text,"axG",%progbits,.foo,comdat' > conftest.s
++        ;;
++      *)
++        $as_echo '.section .text,"axG",%progbits,.foo,comdat' > conftest.s
++        ;;
++    esac
+     if { ac_try='$gcc_cv_as $gcc_cv_as_flags $fw_as_opt -o conftest.o 
conftest.s >&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+@@ -33389,7 +33403,7 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" 
  esac
  
  case "$target:$tm_file" in
@@ -28,7 +60,7 @@ Index: gcc/configure
    case "$target" in
       *le-*-linux*)
       emul_name="-melf64lppc"
-@@ -33403,6 +33403,10 @@ case "$target:$tm_file" in
+@@ -33403,6 +33417,10 @@ case "$target:$tm_file" in
       *-*-freebsd*)
       emul_name="-melf64ppc_fbsd"
        ;;
@@ -39,7 +71,7 @@ Index: gcc/configure
    esac
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker support for 
omitting dot symbols" >&5
  $as_echo_n "checking linker support for omitting dot symbols... " >&6; }
-@@ -33702,6 +33706,7 @@ else
+@@ -33702,6 +33720,7 @@ else
  fi
  
          ;;
@@ -47,7 +79,7 @@ Index: gcc/configure
         *) gcc_cv_libc_provides_ssp=no ;;
      esac
    fi
-@@ -33722,6 +33727,7 @@ if test "${enable_default_ssp+set}" = set; then :
+@@ -33722,6 +33741,7 @@ if test "${enable_default_ssp+set}" = set; then :
  if test x$gcc_cv_libc_provides_ssp = xyes; then
    case "$target" in
      ia64*-*-*) enable_default_ssp=no ;;
@@ -55,7 +87,7 @@ Index: gcc/configure
      *) enable_default_ssp=$enableval ;;
    esac
  else
-@@ -33898,6 +33904,9 @@ $as_echo_n "checking dl_iterate_phdr in target C libra
+@@ -33898,6 +33918,9 @@ $as_echo_n "checking dl_iterate_phdr in target C libra
  gcc_cv_target_dl_iterate_phdr=unknown
  case "$target" in
    *-*-solaris2*)


-- 
wbr, Kirill

Reply via email to