This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: PR target/80204 (Darwin macosx-version-min problem)


In gcc/config/darwin-driver.c, darwin_find_version_from_kernel() assumes
that the minor version in the Darwin kernel version (16.7.0, => minor
version 7) is equal to the bugfix component of the macOS version, so that
the compiler receives -mmacosx-version-min=10.12.7 and the linker receives
-macosx_version_min 10.12.7.

Unfortunately, Apple don’t apply this algorithm; the macOS version is
actually 10.12.6.

Getting this wrong means that it’s impossible to run an executable from 
within a bundle: Sierra complains "You have macOS 10.12.6. The application
requires macOS 10.12.7 or later".

A workround would perhaps be to link the executable with
-Wl,-macosx_version_min,`sw_vers -productVersion` (I assume that it’s only
the linker phase that matters?)

I see that Apple’s gcc (Apple LLVM version 8.0.0
(clang-800.0.42.1)) specifies - only at link time -
 -macosx_version_min 10.12.0

This patch does the same.

gcc/Changelog:

	2017-09-01 Simon Wright <simon@pushface.org>

	PR target/80204
	* config/darwin-driver.c (darwin_find_version_from_kernel): eliminate calculation of the
	  minor version, always output as 0.

Attachment: 80204-darwin-driver.c.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]