enable LTO for Python, from robert@ with some tweaks

earlier version ok kmos@
This commit is contained in:
sthen 2022-04-28 14:47:56 +00:00
parent 0ef26d1388
commit f7b24540a9
10 changed files with 62 additions and 4 deletions

View File

@ -8,4 +8,6 @@ SHARED_LIBS = python3.10 0.0
VERSION_SPEC = >=3.10,<3.11
PORTROACH = limit:^3\.10
REVISION = 0
.include <bsd.port.mk>

View File

@ -19,5 +19,9 @@ multi-arch platform and it causes build problems.
5. Make sure CPPFLAGS/LDFLAGS passed to ./configure don't end up
in PY_CPPFLAGS/PY_LDFLAGS and thus leaking to python extensions.
6. Allow Python to build with LTO on OpenBSD clang architectures.
OpenBSD's version of llvm-ar is installed as /usr/bin/ar, and the
compiler as passed to ports builds is /usr/bin/cc.
These changes are available in the OpenBSD CVS repository
<http://www.openbsd.org/anoncvs.html> in ports/lang/python/3.9.

View File

@ -1,6 +1,7 @@
#1: Set ports library version
#2: Don't pick up an installed linux/e2fsprogs libuuid.so
#3: OpenBSD isn't multi-arch
#3: llvm-ar (used for LTO) is installed as ar
#4: OpenBSD isn't multi-arch
Index: configure.ac
--- configure.ac.orig
@ -22,6 +23,18 @@ Index: configure.ac
[MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
)
AC_SUBST([MULTIARCH])
@@ -1380,9 +1381,9 @@ fi],
[AC_MSG_RESULT(no)])
if test "$Py_LTO" = 'true' ; then
case $CC in
- *clang*)
+ *clang*|cc)
AC_SUBST(LLVM_AR)
- AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
+ AC_PATH_TOOL(LLVM_AR, ar, '', ${llvm_path})
AC_SUBST(LLVM_AR_FOUND)
if test -n "${LLVM_AR}" -a -x "${LLVM_AR}"
then
@@ -2905,18 +2906,7 @@ AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/S
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX

View File

@ -8,6 +8,6 @@ SHARED_LIBS = python3.8 0.0
VERSION_SPEC = >=3.8,<3.9
PORTROACH = limit:^3\.8
REVISION-main = 0
REVISION = 1
.include <bsd.port.mk>

View File

@ -15,5 +15,9 @@ multi-arch platform and it causes build problems.
5. Make sure CPPFLAGS/LDFLAGS passed to ./configure don't end up
in PY_CPPFLAGS/PY_LDFLAGS and thus leaking to python extensions.
6. Allow Python to build with LTO on OpenBSD clang architectures.
OpenBSD's version of llvm-ar is installed as /usr/bin/ar, and the
compiler as passed to ports builds is /usr/bin/cc.
These changes are available in the OpenBSD CVS repository
<http://www.openbsd.org/anoncvs.html> in ports/lang/python/3.8.

View File

@ -1,6 +1,7 @@
#1: Set ports library version
#2: Don't pick up an installed linux/e2fsprogs libuuid.so
#3: OpenBSD isn't multi-arch
#3: llvm-ar (used for LTO) is installed as ar
#4: OpenBSD isn't multi-arch
Index: configure.ac
--- configure.ac.orig
@ -34,6 +35,18 @@ Index: configure.ac
fi
AC_SUBST(MULTIARCH)
@@ -1357,9 +1357,9 @@ fi],
[AC_MSG_RESULT(no)])
if test "$Py_LTO" = 'true' ; then
case $CC in
- *clang*)
+ *clang*|cc)
AC_SUBST(LLVM_AR)
- AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
+ AC_PATH_TOOL(LLVM_AR, ar, '', ${llvm_path})
AC_SUBST(LLVM_AR_FOUND)
if test -n "${LLVM_AR}" -a -x "${LLVM_AR}"
then
@@ -2813,18 +2813,7 @@ AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/S
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX

View File

@ -8,6 +8,8 @@ SHARED_LIBS = python3.9 0.0
VERSION_SPEC = >=3.9,<3.10
PORTROACH = limit:^3\.9
REVISION = 0
# This is the MODPY_DEFAULT_VERSION_3 version of Python:
# - override "@comment" setting so that bin/python3 etc are installed
PY_DEFAULTONLY =

View File

@ -15,5 +15,9 @@ multi-arch platform and it causes build problems.
5. Make sure CPPFLAGS/LDFLAGS passed to ./configure don't end up
in PY_CPPFLAGS/PY_LDFLAGS and thus leaking to python extensions.
6. Allow Python to build with LTO on OpenBSD clang architectures.
OpenBSD's version of llvm-ar is installed as /usr/bin/ar, and the
compiler as passed to ports builds is /usr/bin/cc.
These changes are available in the OpenBSD CVS repository
<http://www.openbsd.org/anoncvs.html> in ports/lang/python/3.9.

View File

@ -1,6 +1,7 @@
#1: Set ports library version
#2: Don't pick up an installed linux/e2fsprogs libuuid.so
#3: OpenBSD isn't multi-arch
#3: llvm-ar (used for LTO) is installed as ar
#4: OpenBSD isn't multi-arch
Index: configure.ac
--- configure.ac.orig
@ -33,6 +34,18 @@ Index: configure.ac
[MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
)
AC_SUBST([MULTIARCH])
@@ -1383,9 +1384,9 @@ fi],
[AC_MSG_RESULT(no)])
if test "$Py_LTO" = 'true' ; then
case $CC in
- *clang*)
+ *clang*|cc)
AC_SUBST(LLVM_AR)
- AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
+ AC_PATH_TOOL(LLVM_AR, ar, '', ${llvm_path})
AC_SUBST(LLVM_AR_FOUND)
if test -n "${LLVM_AR}" -a -x "${LLVM_AR}"
then
@@ -2865,18 +2866,7 @@ AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/S
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX

View File

@ -113,6 +113,9 @@ CONFIGURE_ARGS += --with-fpectl \
--with-system-ffi
.if ${VERSION} != "2.7"
CONFIGURE_ARGS += --enable-loadable-sqlite-extensions
. if ${PROPERTIES:Mlld}
CONFIGURE_ARGS += --with-lto
. endif
TEST_IS_INTERACTIVE = Yes
.endif