Skip to content

Commit

Permalink
Changes to make sure that nonfragile ABI settings are implied by gnu/…
Browse files Browse the repository at this point in the history
…ng runtime
  • Loading branch information
rfm committed Jul 9, 2018
1 parent d13a709 commit 4e4a202
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 176 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
@@ -1,3 +1,17 @@
2018-07-09 Richard Frith-Macdonald <rfm@gnu.org>

* Documentation/library-combo.7:
* common.make:
* config.make.in:
* configure:
* configure.ac:
* library-combo.make:
Changes removing nonfragile ABI settings I made over a year ago and
somehow failed to commit. With the ng runtime we always use the
nonfragile ABI (since it's required for ARC). With the gnu runtime
we don't have it and can't use it. Anything else is for experts
(and if we want to make that easier it's better done in gnustep-base).

2018-07-05 Wolfgang Lux <wolfgang.lux@gmail.com>

* Instance/framework.make:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/library-combo.7
Expand Up @@ -52,7 +52,7 @@ Until now three libraries provide or try to provide OpenStep compliant systems:
If a program wants to work with all the possible combinations it will have to provide different binaries for each combination because it's not possible to have a tool compiled for NeXT Foundation that runs with gnustep-base or vice-versa. To summarize, a program can be compiled for these combinations:
.TP
.B Objective-C runtime
ng (for GNUstep Next Generation), gnu (for
ng (for GNUstep Next Generation with nonfragile API and ARC support etc), gnu (for
.SM GNU
, or for GNUstep without latest language features), apple (for Apple), nx (for NeXT)
.TP
Expand Down
11 changes: 0 additions & 11 deletions common.make
Expand Up @@ -664,17 +664,6 @@ ifeq ($(USE_OBJC_EXCEPTIONS), yes)
INTERNAL_LDFLAGS += -fexceptions
endif

# If the compiler supports nonfragile ABI and the user wants us to
# use them, turn them on!
ifeq ($(USE_NONFRAGILE_ABI), yes)
INTERNAL_OBJCFLAGS += -fobjc-nonfragile-abi -D_NONFRAGILE_ABI
endif

# If we are using garbage collection we set a define to say so.
ifeq ($(OBJC_WITH_GC), yes)
INTERNAL_OBJCFLAGS += -DGS_WITH_GC=1
endif

#
# Now decide whether to build shared objects or not. Nothing depending
# on the value of the shared variable is allowed before this point!
Expand Down
5 changes: 0 additions & 5 deletions config.make.in
Expand Up @@ -206,11 +206,6 @@ AUTO_DEPENDENCIES = @AUTO_DEPENDENCIES@
#
USE_OBJC_EXCEPTIONS = @USE_OBJC_EXCEPTIONS@

#
# Whether the ObjC compiler supports -fobjc-nonfragile-abi
#
USE_NONFRAGILE_ABI = @USE_NONFRAGILE_ABI@

#
# Whether the ObjC compiler supports -fobjc-arc
#
Expand Down
98 changes: 2 additions & 96 deletions configure
Expand Up @@ -611,7 +611,6 @@ USE_OBJC_EXCEPTIONS
CLANG_CC
OBJ_MERGE_CMD_FLAG
USE_ARC
USE_NONFRAGILE_ABI
OBJCXX
ac_cv_objc_threaded
objc_threaded
Expand Down Expand Up @@ -779,7 +778,6 @@ enable_backend_bundle
enable_install_ld_so_conf
with_objc_lib_flag
with_thread_lib
enable_objc_nonfragile_abi
enable_objc_arc
enable_native_objc_exceptions
enable_debug_by_default
Expand Down Expand Up @@ -1496,11 +1494,6 @@ Optional Features:
gnustep-make.conf ineffective.
--enable-objc-nonfragile-abi
Use the non-fragile ABI for Objective-C. Use this option if you want
to use non-fragile instance variables provided by clang and libobjc2.
--enable-objc-arc
Use automatic retain counts for Objective-C. Use this option if you want
to use the ARC mechanism of the Objective-C compiler and runtime.
Expand Down Expand Up @@ -6010,94 +6003,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$OBJC_RUNTIME_LIB" != ng; then
#--------------------------------------------------------------------
# Check if compiler supports -fobjc-nonfragile-abi, and if so, turn it on!
#--------------------------------------------------------------------
# Check whether --enable-objc-nonfragile-abi was given.
if test "${enable_objc_nonfragile_abi+set}" = set; then :
enableval=$enable_objc_nonfragile_abi; USE_NONFRAGILE_ABI=$enableval
else
USE_NONFRAGILE_ABI=notset
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we should use the nonfragile ABI" >&5
$as_echo_n "checking whether we should use the nonfragile ABI... " >&6; }
if test x"$USE_NONFRAGILE_ABI" = x"yes"; then
# What we want to do: set USE_NONFRAGILE_ABI to yes if we can compile
# something with -fobjc-nonfragile-abi.
CFLAGS_no_nonfragile="$CFLAGS"
CFLAGS="$CFLAGS -fobjc-nonfragile-abi"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Note that we never execute this code so it does not really matter
what it is. We are testing that the compiler accepts the
'-fobjc-nonfragile-abi' flag. */
int
main()
{
#ifndef __has_feature
#define __has_feature(x) 0
#endif
return __has_feature(objc_nonfragile_abi) ? 0 : 1;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
USE_NONFRAGILE_ABI=yes
else
USE_NONFRAGILE_ABI=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NONFRAGILE_ABI" >&5
$as_echo "$USE_NONFRAGILE_ABI" >&6; }
CFLAGS="$CFLAGS_no_nonfragile"
if test x"$USE_NONFRAGILE_ABI" = x"no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The nonfragile ABI was requested, but the compiler" >&5
$as_echo "$as_me: The nonfragile ABI was requested, but the compiler" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: doesn't support it." >&5
$as_echo "$as_me: doesn't support it." >&6;}
as_fn_error $? "compiler doesn't support nonfragile ABI" "$LINENO" 5
fi
else
if test x"$USE_NONFRAGILE_ABI" != x"no"; then
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -x objective-c"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __has_feature
#define __has_feature(x) 0
#endif
__has_feature(objc_nonfragile_abi)
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "^1$" >/dev/null 2>&1; then :
USE_NONFRAGILE_ABI=yes
else
USE_NONFRAGILE_ABI=no
fi
rm -f conftest*
CPPFLAGS=$saved_CPPFLAGS
fi
if test x"$USE_NONFRAGILE_ABI" = x"yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (compiler default)" >&5
$as_echo "yes (compiler default)" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not requested by user" >&5
$as_echo "not requested by user" >&6; }
fi
fi
fi
#--------------------------------------------------------------------
# Check if compiler supports -fobjc-arc, and if so, turn it on!
#--------------------------------------------------------------------
Expand Down Expand Up @@ -6154,7 +6059,8 @@ else
if test x"$USE_ARC" != x"no"; then
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -x objective-c"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __has_feature
Expand Down
61 changes: 0 additions & 61 deletions configure.ac
Expand Up @@ -1411,67 +1411,6 @@ CXXFLAGS="$CXXFLAGS_saved"
CXXPPFLAGS="$CXXPPFLAGS_saved"
AC_LANG_POP(C++)

if test "$OBJC_RUNTIME_LIB" != ng; then
#--------------------------------------------------------------------
# Check if compiler supports -fobjc-nonfragile-abi, and if so, turn it on!
#--------------------------------------------------------------------

AC_ARG_ENABLE(objc-nonfragile-abi, [
--enable-objc-nonfragile-abi
Use the non-fragile ABI for Objective-C. Use this option if you want
to use non-fragile instance variables provided by clang and libobjc2.
],
USE_NONFRAGILE_ABI=$enableval,
USE_NONFRAGILE_ABI=notset)

AC_MSG_CHECKING(whether we should use the nonfragile ABI)
if test x"$USE_NONFRAGILE_ABI" = x"yes"; then
# What we want to do: set USE_NONFRAGILE_ABI to yes if we can compile
# something with -fobjc-nonfragile-abi.
CFLAGS_no_nonfragile="$CFLAGS"
CFLAGS="$CFLAGS -fobjc-nonfragile-abi"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
/* Note that we never execute this code so it does not really matter
what it is. We are testing that the compiler accepts the
'-fobjc-nonfragile-abi' flag. */
int
main()
{
#ifndef __has_feature
#define __has_feature(x) 0
#endif
return __has_feature(objc_nonfragile_abi) ? 0 : 1;
}
]])], USE_NONFRAGILE_ABI=yes, USE_NONFRAGILE_ABI=no)
AC_MSG_RESULT($USE_NONFRAGILE_ABI)
CFLAGS="$CFLAGS_no_nonfragile"

if test x"$USE_NONFRAGILE_ABI" = x"no"; then
AC_MSG_NOTICE([The nonfragile ABI was requested, but the compiler])
AC_MSG_NOTICE([doesn't support it.])
AC_MSG_ERROR([compiler doesn't support nonfragile ABI])
fi
else
if test x"$USE_NONFRAGILE_ABI" != x"no"; then
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -x objective-c"
AC_EGREP_CPP([^1$], [
#ifndef __has_feature
#define __has_feature(x) 0
#endif
__has_feature(objc_nonfragile_abi)
], USE_NONFRAGILE_ABI=yes, USE_NONFRAGILE_ABI=no)
CPPFLAGS=$saved_CPPFLAGS
fi
if test x"$USE_NONFRAGILE_ABI" = x"yes"; then
AC_MSG_RESULT([yes (compiler default)])
else
AC_MSG_RESULT(not requested by user)
fi
fi
fi
AC_SUBST(USE_NONFRAGILE_ABI)

#--------------------------------------------------------------------
# Check if compiler supports -fobjc-arc, and if so, turn it on!
#--------------------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions library-combo.make
Expand Up @@ -38,8 +38,11 @@ endif
ifeq ($(OBJC_RUNTIME_LIB), ng)
OBJC_LDFLAGS =
OBJC_LIB_DIR =
OBJC_LIBS = $(OBJC_LIB_FLAG) -fobjc-nonfragile-abi
RUNTIME_FLAG = -fobjc-runtime=gnustep-1.8 -fblocks
OBJC_LIBS = $(OBJC_LIB_FLAG)
ifeq ($(RUNTIME_VERSION),)
RUNTIME_VERSION=gnustep-1.8
endif
RUNTIME_FLAG = -fobjc-runtime=$(RUNTIME_VERSION) -fblocks
RUNTIME_DEFINE = -DGNUSTEP_RUNTIME=1 -D_NONFRAGILE_ABI=1
# Projects may control the use of ARC by defining GS_WITH_ARC=1
# or GS_WITH_ARC=0 at the start of their GNUmakefile, or in the environment,
Expand Down

0 comments on commit 4e4a202

Please sign in to comment.