Index: gcc/config/i386/sol2.h
--- gcc/config/i386/sol2.h.orig	2019-01-09 22:37:45.000000000 +0100
+++ gcc/config/i386/sol2.h	2019-05-07 08:14:25.850968000 +0200
@@ -144,6 +144,9 @@
   } while (0)
 #endif
 
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 1
+
 /* The Solaris assembler wants a .local for non-exported aliases.  */
 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)	\
   do {							\
Index: gcc/config/sol2.h
--- gcc/config/sol2.h.orig	2019-01-01 13:31:55.000000000 +0100
+++ gcc/config/sol2.h	2019-05-07 08:14:25.851308000 +0200
@@ -419,9 +419,9 @@
   "%{h*} %{v:-V} \
    %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
    %{static:-dn -Bstatic} \
-   %{shared:-G -dy %{!mimpure-text:-z text}} " \
+   %{shared:-G -dy} " \
    LINK_LIBGCC_MAPFILE_SPEC LINK_CLEARCAP_SPEC " \
-   %{symbolic:-Bsymbolic -G -dy -z text} \
+   %{symbolic:-Bsymbolic -G -dy} \
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"
 
Index: gcc/system.h
--- gcc/system.h.orig	2021-04-08 13:56:28.581746862 +0200
+++ gcc/system.h	2021-04-09 09:14:00.018136000 +0200
@@ -94,7 +94,7 @@
 #  undef getchar
 #  define getchar() getchar_unlocked ()
 # endif
-# ifdef HAVE_FPUTC_UNLOCKED
+# if defined(HAVE_FPUTC_UNLOCKED) && !defined(__FreeBSD__)
 #  undef fputc
 #  define fputc(C, Stream) fputc_unlocked (C, Stream)
 # endif
Index: libcpp/internal.h
--- libcpp/internal.h.orig	2019-01-26 11:08:00.000000000 +0100
+++ libcpp/internal.h	2019-05-07 08:14:25.852032000 +0200
@@ -28,6 +28,7 @@
 #if HAVE_ICONV
 #include <iconv.h>
 #else
+#undef  HAVE_ICONV
 #define HAVE_ICONV 0
 typedef int iconv_t;  /* dummy */
 #endif
Index: libcpp/system.h
--- libcpp/system.h.orig	2021-04-08 13:56:29.785761398 +0200
+++ libcpp/system.h	2021-04-09 08:43:50.230521000 +0200
@@ -90,7 +90,7 @@
 #  undef getchar
 #  define getchar() getchar_unlocked ()
 # endif
-# ifdef HAVE_FPUTC_UNLOCKED
+# if defined(HAVE_FPUTC_UNLOCKED) && !defined(__FreeBSD__)
 #  undef fputc
 #  define fputc(C, Stream) fputc_unlocked (C, Stream)
 # endif
