// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

#if !defined(__COREFOUNDATION_CFASMMACROS__)
#define __COREFOUNDATION_CFASMMACROS__ 1

#define CONCAT(a,b) a##b
#define CONCAT_EXPANDED(a,b) CONCAT(a,b)
#define _C_LABEL(name) CONCAT_EXPANDED(__USER_LABEL_PREFIX__,name)

#if defined(__GNU__) || defined(__GNUC__) || defined(__ANDROID__) || defined(__FreeBSD__)
#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
#else
#define NO_EXEC_STACK_DIRECTIVE
#endif

#endif


// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//

#if !defined(__COREFOUNDATION_CFASMMACROS__)
#define __COREFOUNDATION_CFASMMACROS__ 1

#define CONCAT(a,b) a##b
#define CONCAT_EXPANDED(a,b) CONCAT(a,b)
#define _C_LABEL(name) CONCAT_EXPANDED(__USER_LABEL_PREFIX__,name)

#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__)
#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
#else
#define NO_EXEC_STACK_DIRECTIVE
#endif

#endif


--- 
+++ 
@@ -14,7 +14,7 @@
 #define CONCAT_EXPANDED(a,b) CONCAT(a,b)
 #define _C_LABEL(name) CONCAT_EXPANDED(__USER_LABEL_PREFIX__,name)
 
-#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__)
+#if defined(__GNU__) || defined(__GNUC__) || defined(__ANDROID__) || defined(__FreeBSD__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
Fix libFoundation.so being flagged as requiring executable stack

libFoundation.so is flagged as requiring an executable stack on Linux, although it does not. This is due to GNU as behavior.
Please see discussion at https://bugs.swift.org/browse/SR-2700?jql=text%20~%20%22executable%20stack%22

This was already intended to be solved by https://github.com/apple/swift-corelibs-foundation/pull/649/, but did not work as intended in Ubuntu. Checking for __GNUC__ in addition resolves the issue.
