summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-09-11 11:55:29 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-09-12 07:39:05 +0200
commit25f36066dd2abde74faa12f08e5e498a95128cd0 (patch)
tree96d1fb2ba36da0fcde15441b86bbb33e61a795ee /src
parente92677e86333562b8dd4972083c8a1abf985d90d (diff)
Remove traces of support for Sun Studio compiler
Per discussion, this compiler suite is no longer maintained, and it has not been able to compile PostgreSQL since at least PostgreSQL 17. This removes all the remaining support code for this compiler. Note that the Solaris operating system continues to be supported, but using GCC as the compiler. Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/a0f817ee-fb86-483a-8a14-b6f7f5991b6e%40eisentraut.org
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.global.in4
-rw-r--r--src/backend/port/Makefile12
-rw-r--r--src/backend/port/tas/sunstudio_sparc.s53
-rw-r--r--src/backend/port/tas/sunstudio_x86.s43
-rw-r--r--src/backend/storage/lmgr/Makefile6
-rw-r--r--src/include/c.h15
-rw-r--r--src/include/port/atomics.h2
-rw-r--r--src/include/port/atomics/arch-x86.h2
-rw-r--r--src/include/port/atomics/generic-sunpro.h113
-rw-r--r--src/include/port/solaris.h21
-rw-r--r--src/include/storage/s_lock.h24
-rw-r--r--src/makefiles/meson.build4
-rw-r--r--src/template/linux23
-rw-r--r--src/template/solaris29
-rwxr-xr-xsrc/tools/pginclude/headerscheck1
15 files changed, 14 insertions, 338 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 8b1b357beaa..0aa389bc710 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -267,7 +267,6 @@ endif # not PGXS
CC = @CC@
GCC = @GCC@
-SUN_STUDIO_CC = @SUN_STUDIO_CC@
CXX = @CXX@
CFLAGS = @CFLAGS@
CFLAGS_SL = @CFLAGS_SL@
@@ -796,9 +795,6 @@ ifeq ($(PORTNAME),win32)
LIBS += -lws2_32
endif
-# Not really standard libc functions, used by the backend.
-TAS = @TAS@
-
##########################################################################
#
diff --git a/src/backend/port/Makefile b/src/backend/port/Makefile
index 47338d99229..8613ac01aff 100644
--- a/src/backend/port/Makefile
+++ b/src/backend/port/Makefile
@@ -22,7 +22,6 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
OBJS = \
- $(TAS) \
atomics.o \
pg_sema.o \
pg_shmem.o
@@ -33,16 +32,5 @@ endif
include $(top_srcdir)/src/backend/common.mk
-tas.o: tas.s
-ifeq ($(SUN_STUDIO_CC), yes)
-# preprocess assembler file with cpp
- $(CC) $(CFLAGS) -c -P $<
- mv $*.i $*_cpp.s
- $(CC) $(CFLAGS) -c $*_cpp.s -o $@
-else
- $(CC) $(CFLAGS) -c $<
-endif
-
clean:
- rm -f tas_cpp.s
$(MAKE) -C win32 clean
diff --git a/src/backend/port/tas/sunstudio_sparc.s b/src/backend/port/tas/sunstudio_sparc.s
deleted file mode 100644
index 8e0a0965b64..00000000000
--- a/src/backend/port/tas/sunstudio_sparc.s
+++ /dev/null
@@ -1,53 +0,0 @@
-!-------------------------------------------------------------------------
-!
-! sunstudio_sparc.s
-! compare and swap for Sun Studio on Sparc
-!
-! Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
-! Portions Copyright (c) 1994, Regents of the University of California
-!
-! IDENTIFICATION
-! src/backend/port/tas/sunstudio_sparc.s
-!
-!-------------------------------------------------------------------------
-
-! Fortunately the Sun compiler can process cpp conditionals with -P
-
-! '/' is the comment for x86, while '!' is the comment for Sparc
-
-#if defined(__sparcv9) || defined(__sparc)
-
- .section ".text"
- .align 8
- .skip 24
- .align 4
-
- .global pg_atomic_cas
-pg_atomic_cas:
-
- ! "cas" only works on sparcv9 and sparcv8plus chips, and
- ! requires a compiler targeting these CPUs. It will fail
- ! on a compiler targeting sparcv8, and of course will not
- ! be understood by a sparcv8 CPU. gcc continues to use
- ! "ldstub" because it targets sparcv7.
- !
- ! There is actually a trick for embedding "cas" in a
- ! sparcv8-targeted compiler, but it can only be run
- ! on a sparcv8plus/v9 cpus:
- !
- ! http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libc/sparc/threads/sparc.il
- !
- ! NB: We're assuming we're running on a TSO system here - solaris
- ! userland luckily always has done so.
-
-#if defined(__sparcv9) || defined(__sparcv8plus)
- cas [%o0],%o2,%o1
-#else
- ldstub [%o0],%o1
-#endif
- mov %o1,%o0
- retl
- nop
- .type pg_atomic_cas,2
- .size pg_atomic_cas,(.-pg_atomic_cas)
-#endif
diff --git a/src/backend/port/tas/sunstudio_x86.s b/src/backend/port/tas/sunstudio_x86.s
deleted file mode 100644
index 0111ffde45c..00000000000
--- a/src/backend/port/tas/sunstudio_x86.s
+++ /dev/null
@@ -1,43 +0,0 @@
-/-------------------------------------------------------------------------
-/
-/ sunstudio_x86.s
-/ compare and swap for Sun Studio on x86
-/
-/ Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
-/ Portions Copyright (c) 1994, Regents of the University of California
-/
-/ IDENTIFICATION
-/ src/backend/port/tas/sunstudio_x86.s
-/
-/-------------------------------------------------------------------------
-
-/ Fortunately the Sun compiler can process cpp conditionals with -P
-
-/ '/' is the comment for x86, while '!' is the comment for Sparc
-
- .file "tas.s"
-
-#if defined(__amd64)
- .code64
-#endif
-
- .globl pg_atomic_cas
- .type pg_atomic_cas, @function
-
- .section .text, "ax"
- .align 16
-
-pg_atomic_cas:
-#if defined(__amd64)
- movl %edx,%eax
- lock
- cmpxchgl %esi,(%rdi)
-#else
- movl 4(%esp), %edx
- movl 8(%esp), %ecx
- movl 12(%esp), %eax
- lock
- cmpxchgl %ecx, (%edx)
-#endif
- ret
- .size pg_atomic_cas, . - pg_atomic_cas
diff --git a/src/backend/storage/lmgr/Makefile b/src/backend/storage/lmgr/Makefile
index 6cbaf23b855..a5fbc24ddad 100644
--- a/src/backend/storage/lmgr/Makefile
+++ b/src/backend/storage/lmgr/Makefile
@@ -24,13 +24,9 @@ OBJS = \
include $(top_srcdir)/src/backend/common.mk
-ifdef TAS
-TASPATH = $(top_builddir)/src/backend/port/tas.o
-endif
-
s_lock_test: s_lock.c $(top_builddir)/src/common/libpgcommon.a $(top_builddir)/src/port/libpgport.a
$(CC) $(CPPFLAGS) $(CFLAGS) -DS_LOCK_TEST=1 $(srcdir)/s_lock.c \
- $(TASPATH) -L $(top_builddir)/src/common -lpgcommon \
+ -L $(top_builddir)/src/common -lpgcommon \
-L $(top_builddir)/src/port -lpgport -lm -o s_lock_test
lwlocknames.h: ../../../include/storage/lwlocklist.h ../../utils/activity/wait_event_names.txt generate-lwlocknames.pl
diff --git a/src/include/c.h b/src/include/c.h
index b580cfa7d31..f303ba0605a 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -114,7 +114,6 @@
* GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
* GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
* Clang: https://clang.llvm.org/docs/AttributeReference.html
- * Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html
*/
/*
@@ -157,7 +156,7 @@
*/
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define pg_noreturn _Noreturn
-#elif defined(__GNUC__) || defined(__SUNPRO_C)
+#elif defined(__GNUC__)
#define pg_noreturn __attribute__((noreturn))
#elif defined(_MSC_VER)
#define pg_noreturn __declspec(noreturn)
@@ -233,8 +232,8 @@
#define pg_attribute_printf(f,a)
#endif
-/* GCC and Sunpro support aligned and packed */
-#if defined(__GNUC__) || defined(__SUNPRO_C)
+/* GCC supports aligned and packed */
+#if defined(__GNUC__)
#define pg_attribute_aligned(a) __attribute__((aligned(a)))
#define pg_attribute_packed() __attribute__((packed))
#elif defined(_MSC_VER)
@@ -259,8 +258,8 @@
* choose not to. But, if possible, don't force inlining in unoptimized
* debug builds.
*/
-#if (defined(__GNUC__) && defined(__OPTIMIZE__)) || defined(__SUNPRO_C)
-/* GCC and Sunpro support always_inline via __attribute__ */
+#if defined(__GNUC__) && defined(__OPTIMIZE__)
+/* GCC supports always_inline via __attribute__ */
#define pg_attribute_always_inline __attribute__((always_inline)) inline
#elif defined(_MSC_VER)
/* MSVC has a special keyword for this */
@@ -276,8 +275,8 @@
* for proper cost attribution. Note that unlike the pg_attribute_XXX macros
* above, this should be placed before the function's return type and name.
*/
-/* GCC and Sunpro support noinline via __attribute__ */
-#if defined(__GNUC__) || defined(__SUNPRO_C)
+/* GCC supports noinline via __attribute__ */
+#if defined(__GNUC__)
#define pg_noinline __attribute__((noinline))
/* msvc via declspec */
#elif defined(_MSC_VER)
diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h
index 074136fe4c4..96f1858da97 100644
--- a/src/include/port/atomics.h
+++ b/src/include/port/atomics.h
@@ -88,8 +88,6 @@
#include "port/atomics/generic-gcc.h"
#elif defined(_MSC_VER)
#include "port/atomics/generic-msvc.h"
-#elif defined(__SUNPRO_C) && !defined(__GNUC__)
-#include "port/atomics/generic-sunpro.h"
#else
/* Unknown compiler. */
#endif
diff --git a/src/include/port/atomics/arch-x86.h b/src/include/port/atomics/arch-x86.h
index 8983dd89d53..4ba2ccc0591 100644
--- a/src/include/port/atomics/arch-x86.h
+++ b/src/include/port/atomics/arch-x86.h
@@ -241,6 +241,6 @@ pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
*/
#if defined(__i568__) || defined(__i668__) || /* gcc i586+ */ \
(defined(_M_IX86) && _M_IX86 >= 500) || /* msvc i586+ */ \
- defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) /* gcc, sunpro, msvc */
+ defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) /* gcc, msvc */
#define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY
#endif /* 8 byte single-copy atomicity */
diff --git a/src/include/port/atomics/generic-sunpro.h b/src/include/port/atomics/generic-sunpro.h
deleted file mode 100644
index 09bba0be203..00000000000
--- a/src/include/port/atomics/generic-sunpro.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * generic-sunpro.h
- * Atomic operations for solaris' CC
- *
- * Portions Copyright (c) 2013-2025, PostgreSQL Global Development Group
- *
- * NOTES:
- *
- * Documentation:
- * * manpage for atomic_cas(3C)
- * http://www.unix.com/man-page/opensolaris/3c/atomic_cas/
- * http://docs.oracle.com/cd/E23824_01/html/821-1465/atomic-cas-3c.html
- *
- * src/include/port/atomics/generic-sunpro.h
- *
- * -------------------------------------------------------------------------
- */
-
-#ifdef HAVE_MBARRIER_H
-#include <mbarrier.h>
-
-#define pg_compiler_barrier_impl() __compiler_barrier()
-
-#ifndef pg_memory_barrier_impl
-/*
- * Despite the name this is actually a full barrier. Expanding to mfence/
- * membar #StoreStore | #LoadStore | #StoreLoad | #LoadLoad on x86/sparc
- * respectively.
- */
-# define pg_memory_barrier_impl() __machine_rw_barrier()
-#endif
-#ifndef pg_read_barrier_impl
-# define pg_read_barrier_impl() __machine_r_barrier()
-#endif
-#ifndef pg_write_barrier_impl
-# define pg_write_barrier_impl() __machine_w_barrier()
-#endif
-
-#endif /* HAVE_MBARRIER_H */
-
-/* Older versions of the compiler don't have atomic.h... */
-#ifdef HAVE_ATOMIC_H
-
-#include <atomic.h>
-
-#define PG_HAVE_ATOMIC_U32_SUPPORT
-typedef struct pg_atomic_uint32
-{
- volatile uint32 value;
-} pg_atomic_uint32;
-
-#define PG_HAVE_ATOMIC_U64_SUPPORT
-typedef struct pg_atomic_uint64
-{
- /*
- * Syntax to enforce variable alignment should be supported by versions
- * supporting atomic.h, but it's hard to find accurate documentation. If
- * it proves to be a problem, we'll have to add more version checks for 64
- * bit support.
- */
- volatile uint64 value pg_attribute_aligned(8);
-} pg_atomic_uint64;
-
-#endif /* HAVE_ATOMIC_H */
-
-
-#ifdef HAVE_ATOMIC_H
-
-#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
-static inline bool
-pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
- uint32 *expected, uint32 newval)
-{
- bool ret;
- uint32 current;
-
- current = atomic_cas_32(&ptr->value, *expected, newval);
- ret = current == *expected;
- *expected = current;
- return ret;
-}
-
-#define PG_HAVE_ATOMIC_EXCHANGE_U32
-static inline uint32
-pg_atomic_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 newval)
-{
- return atomic_swap_32(&ptr->value, newval);
-}
-
-#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
-static inline bool
-pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
- uint64 *expected, uint64 newval)
-{
- bool ret;
- uint64 current;
-
- AssertPointerAlignment(expected, 8);
- current = atomic_cas_64(&ptr->value, *expected, newval);
- ret = current == *expected;
- *expected = current;
- return ret;
-}
-
-#define PG_HAVE_ATOMIC_EXCHANGE_U64
-static inline uint64
-pg_atomic_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 newval)
-{
- return atomic_swap_64(&ptr->value, newval);
-}
-
-#endif /* HAVE_ATOMIC_H */
diff --git a/src/include/port/solaris.h b/src/include/port/solaris.h
index 8ff40007c7f..c352361c81d 100644
--- a/src/include/port/solaris.h
+++ b/src/include/port/solaris.h
@@ -1,26 +1,5 @@
/* src/include/port/solaris.h */
-/*
- * Sort this out for all operating systems some time. The __xxx
- * symbols are defined on both GCC and Solaris CC, although GCC
- * doesn't document them. The __xxx__ symbols are only on GCC.
- */
-#if defined(__i386) && !defined(__i386__)
-#define __i386__
-#endif
-
-#if defined(__amd64) && !defined(__amd64__)
-#define __amd64__
-#endif
-
-#if defined(__x86_64) && !defined(__x86_64__)
-#define __x86_64__
-#endif
-
-#if defined(__sparc) && !defined(__sparc__)
-#define __sparc__
-#endif
-
#if defined(__i386__)
#include <sys/isa_defs.h>
#endif
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 2f73f9fcf57..7f8f566bd40 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -333,9 +333,9 @@ tas(volatile slock_t *lock)
slock_t _res;
/*
- * See comment in src/backend/port/tas/sunstudio_sparc.s for why this
- * uses "ldstub", and that file uses "cas". gcc currently generates
- * sparcv7-targeted binaries, so "cas" use isn't possible.
+ * "cas" would be better than "ldstub", but it is only present on
+ * sparcv8plus and later, while some platforms still support sparcv7 or
+ * sparcv8. Also, "cas" requires that the system be running in TSO mode.
*/
__asm__ __volatile__(
" ldstub [%2], %0 \n"
@@ -594,24 +594,6 @@ tas(volatile slock_t *lock)
#if !defined(HAS_TEST_AND_SET) /* We didn't trigger above, let's try here */
-/* These are in sunstudio_(sparc|x86).s */
-
-#if defined(__SUNPRO_C) && (defined(__i386) || defined(__x86_64__) || defined(__sparc__) || defined(__sparc))
-#define HAS_TEST_AND_SET
-
-#if defined(__i386) || defined(__x86_64__) || defined(__sparcv9) || defined(__sparcv8plus)
-typedef unsigned int slock_t;
-#else
-typedef unsigned char slock_t;
-#endif
-
-extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with,
- slock_t cmp);
-
-#define TAS(a) (pg_atomic_cas((a), 1, 0) != 0)
-#endif
-
-
#ifdef _MSC_VER
typedef LONG slock_t;
diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build
index 54dbc059ada..0def244c901 100644
--- a/src/makefiles/meson.build
+++ b/src/makefiles/meson.build
@@ -63,8 +63,6 @@ pgxs_kv = {
'DLSUFFIX': dlsuffix,
'EXEEXT': exesuffix,
- 'SUN_STUDIO_CC': 'no', # not supported so far
-
# want the chosen option, rather than the library
'with_ssl' : ssl_library,
'with_uuid': uuidopt,
@@ -179,7 +177,7 @@ pgxs_empty = [
'WANTED_LANGUAGES',
# Not needed because we don't build the server / PLs with the generated makefile
- 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
+ 'LIBOBJS', 'PG_CRC32C_OBJS',
'PG_TEST_EXTRA',
'DTRACEFLAGS', # only server has dtrace probes
diff --git a/src/template/linux b/src/template/linux
index ec3302c4a22..faefe64254a 100644
--- a/src/template/linux
+++ b/src/template/linux
@@ -14,26 +14,3 @@ CFLAGS_SL="-fPIC"
# If --enable-profiling is specified, we need -DLINUX_PROFILE
PLATFORM_PROFILE_FLAGS="-DLINUX_PROFILE"
-
-if test "$SUN_STUDIO_CC" = "yes" ; then
- CC="$CC -Xa" # relaxed ISO C mode
- CFLAGS="-v" # -v is like gcc -Wall
- if test "$enable_debug" != yes; then
- CFLAGS="$CFLAGS -O" # any optimization breaks debug
- fi
-
- # Pick the right test-and-set (TAS) code for the Sun compiler.
- # We would like to use in-line assembler, but the compiler
- # requires *.il files to be on every compile line, making
- # the build system too fragile.
- case $host_cpu in
- sparc)
- need_tas=yes
- tas_file=sunstudio_sparc.s
- ;;
- i?86|x86_64)
- need_tas=yes
- tas_file=sunstudio_x86.s
- ;;
- esac
-fi
diff --git a/src/template/solaris b/src/template/solaris
index f88b1cdad37..a4d8d38a8f8 100644
--- a/src/template/solaris
+++ b/src/template/solaris
@@ -1,31 +1,4 @@
# src/template/solaris
# Extra CFLAGS for code that will go into a shared library
-if test "$GCC" = yes ; then
- CFLAGS_SL="-fPIC"
-else
- CFLAGS_SL="-KPIC"
-fi
-
-if test "$SUN_STUDIO_CC" = yes ; then
- CC="$CC -Xa" # relaxed ISO C mode
- CFLAGS="-v" # -v is like gcc -Wall
- if test "$enable_debug" != yes; then
- CFLAGS="$CFLAGS -O" # any optimization breaks debug
- fi
-
- # Pick the right test-and-set (TAS) code for the Sun compiler.
- # We would like to use in-line assembler, but the compiler
- # requires *.il files to be on every compile line, making
- # the build system too fragile.
- case $host_cpu in
- sparc)
- need_tas=yes
- tas_file=sunstudio_sparc.s
- ;;
- i?86|x86_64)
- need_tas=yes
- tas_file=sunstudio_x86.s
- ;;
- esac
-fi
+CFLAGS_SL="-fPIC"
diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 17138a7569e..d017490a538 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -114,7 +114,6 @@ do
test "$f" = src/include/port/atomics/generic.h && continue
test "$f" = src/include/port/atomics/generic-gcc.h && continue
test "$f" = src/include/port/atomics/generic-msvc.h && continue
- test "$f" = src/include/port/atomics/generic-sunpro.h && continue
# sepgsql.h depends on headers that aren't there on most platforms.
test "$f" = contrib/sepgsql/sepgsql.h && continue