Skip to content

Commit 53da67a

Browse files
compnerdparkera
authored andcommitted
Strings: make the assembly slightly more portable (#469)
This ensures that we get the user label prefix correct for the references to the symbol in the rest of CoreFoundation.
1 parent 26e57c6 commit 53da67a

File tree

7 files changed

+63
-28
lines changed

7 files changed

+63
-28
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This source file is part of the Swift.org open source project
2+
//
3+
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
4+
// Licensed under Apache License v2.0 with Runtime Library Exception
5+
//
6+
// See http://swift.org/LICENSE.txt for license information
7+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8+
//
9+
10+
#if !defined(__COREFOUNDATION_CFASMMACROS__)
11+
#define __COREFOUNDATION_CFASMMACROS__ 1
12+
13+
#define CONCAT(a,b) a##b
14+
#define CONCAT_EXPANDED(a,b) CONCAT(a,b)
15+
#define _C_LABEL(name) CONCAT_EXPANDED(__USER_LABEL_PREFIX__,name)
16+
17+
#endif
18+

CoreFoundation/String.subproj/CFCharacterSetData.S

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
.global __CFCharacterSetBitmapData
11-
__CFCharacterSetBitmapData:
10+
#include <CoreFoundation/CFAsmMacros.h>
11+
12+
.global _C_LABEL(__CFCharacterSetBitmapData)
13+
_C_LABEL(__CFCharacterSetBitmapData):
1214
.incbin "CoreFoundation/CharacterSets/CFCharacterSetBitmaps.bitmap"
1315

14-
.global __CFCharacterSetBitmapDataEnd
15-
__CFCharacterSetBitmapDataEnd:
16+
.global _C_LABEL(__CFCharacterSetBitmapDataEnd)
17+
_C_LABEL(__CFCharacterSetBitmapDataEnd):
1618
.byte 0
1719

18-
.global __CFCharacterSetBitmapDataSize
19-
__CFCharacterSetBitmapDataSize:
20-
.int __CFCharacterSetBitmapDataEnd - __CFCharacterSetBitmapData
20+
.global _C_LABEL(__CFCharacterSetBitmapDataSize)
21+
_C_LABEL(__CFCharacterSetBitmapDataSize):
22+
.int _C_LABEL(__CFCharacterSetBitmapDataEnd) - _C_LABEL(__CFCharacterSetBitmapData)

CoreFoundation/String.subproj/CFUniCharPropertyDatabase.S

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
.global __CFUniCharPropertyDatabase
11-
__CFUniCharPropertyDatabase:
10+
#include <CoreFoundation/CFAsmMacros.h>
11+
12+
.global _C_LABEL(__CFUniCharPropertyDatabase)
13+
_C_LABEL(__CFUniCharPropertyDatabase):
1214
.incbin "CoreFoundation/CharacterSets/CFUniCharPropertyDatabase.data"
1315

14-
.global __CFUniCharPropertyDatabaseEnd
15-
__CFUniCharPropertyDatabaseEnd:
16+
.global _C_LABEL(__CFUniCharPropertyDatabaseEnd)
17+
_C_LABEL(__CFUniCharPropertyDatabaseEnd):
1618
.byte 0
1719

18-
.global __CFUniCharPropertyDatabaseSize
19-
__CFUniCharPropertyDatabaseSize:
20-
.int __CFUniCharPropertyDatabaseEnd - __CFUniCharPropertyDatabase
20+
.global _C_LABEL(__CFUniCharPropertyDatabaseSize)
21+
_C_LABEL(__CFUniCharPropertyDatabaseSize):
22+
.int _C_LABEL(__CFUniCharPropertyDatabaseEnd) - _C_LABEL(__CFUniCharPropertyDatabase)

CoreFoundation/String.subproj/CFUnicodeData.S

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,30 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10+
#include <CoreFoundation/CFAsmMacros.h>
11+
1012
#if defined(__BIG_ENDIAN__)
11-
.global __CFUnicodeDataB
12-
__CFUnicodeDataB:
13+
.global _C_LABEL(__CFUnicodeDataB)
14+
_C_LABEL(__CFUnicodeDataB):
1315
.incbin "CoreFoundation/CharacterSets/CFUnicodeData-B.mapping"
1416

15-
.global __CFUnicodeDataBEnd
16-
__CFUnicodeDataBEnd:
17+
.global _C_LABEL(__CFUnicodeDataBEnd)
18+
_C_LABEL(__CFUnicodeDataBEnd):
1719
.byte 0
1820

19-
.global __CFUnicodeDataBSize
20-
__CFUnicodeDataBSize:
21-
.int __CFUnicodeDataBEnd - __CFUnicodeDataB
21+
.global _C_LABEL(__CFUnicodeDataBSize)
22+
_C_LABEL(__CFUnicodeDataBSize):
23+
.int _C_LABEL(__CFUnicodeDataBEnd) - _C_LABEL(__CFUnicodeDataB)
2224
#else
23-
.global __CFUnicodeDataL
24-
__CFUnicodeDataL:
25+
.global _C_LABEL(__CFUnicodeDataL)
26+
_C_LABEL(__CFUnicodeDataL):
2527
.incbin "CoreFoundation/CharacterSets/CFUnicodeData-L.mapping"
2628

27-
.global __CFUnicodeDataLEnd
28-
__CFUnicodeDataLEnd:
29+
.global _C_LABEL(__CFUnicodeDataLEnd)
30+
_C_LABEL(__CFUnicodeDataLEnd):
2931
.byte 0
3032

31-
.global __CFUnicodeDataLSize
32-
__CFUnicodeDataLSize:
33-
.int __CFUnicodeDataLEnd - __CFUnicodeDataL
33+
.global _C_LABEL(__CFUnicodeDataLSize)
34+
_C_LABEL(__CFUnicodeDataLSize):
35+
.int _C_LABEL(__CFUnicodeDataLEnd) - _C_LABEL(__CFUnicodeDataL)
3436
#endif

Foundation.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@
367367
EADE0BCB1BD15E0000C49C64 /* NSXMLNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = EADE0B8D1BD15DFF00C49C64 /* NSXMLNode.swift */; };
368368
EADE0BCC1BD15E0000C49C64 /* NSXMLNodeOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EADE0B8E1BD15DFF00C49C64 /* NSXMLNodeOptions.swift */; };
369369
EADE0BCD1BD15E0000C49C64 /* NSXMLParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = EADE0B8F1BD15DFF00C49C64 /* NSXMLParser.swift */; };
370+
F03A43181D4877DD00A7791E /* CFAsmMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = F03A43161D48778200A7791E /* CFAsmMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
370371
F9E0BB371CA70B8000F7FF3C /* TestNSURLCredential.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9E0BB361CA70B8000F7FF3C /* TestNSURLCredential.swift */; };
371372
/* End PBXBuildFile section */
372373

@@ -798,6 +799,7 @@
798799
EADE0B8D1BD15DFF00C49C64 /* NSXMLNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSXMLNode.swift; sourceTree = "<group>"; };
799800
EADE0B8E1BD15DFF00C49C64 /* NSXMLNodeOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSXMLNodeOptions.swift; sourceTree = "<group>"; };
800801
EADE0B8F1BD15DFF00C49C64 /* NSXMLParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSXMLParser.swift; sourceTree = "<group>"; };
802+
F03A43161D48778200A7791E /* CFAsmMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFAsmMacros.h; sourceTree = "<group>"; };
801803
F9E0BB361CA70B8000F7FF3C /* TestNSURLCredential.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSURLCredential.swift; sourceTree = "<group>"; };
802804
/* End PBXFileReference section */
803805

@@ -880,6 +882,7 @@
880882
5B5D88711BBC951A00234F36 /* Base */ = {
881883
isa = PBXGroup;
882884
children = (
885+
F03A43161D48778200A7791E /* CFAsmMacros.h */,
883886
5BDC3F721BCC60EF00ED97BB /* module.modulemap */,
884887
5B5D88741BBC954000234F36 /* CFAvailability.h */,
885888
5B5D895D1BBDABBF00234F36 /* CFBase.c */,
@@ -1643,6 +1646,7 @@
16431646
5B7C8AD51BEA80FC00C5B690 /* CFBundle.h in Headers */,
16441647
5B6228C11C17905B009587FE /* CFAttributedString.h in Headers */,
16451648
5B7C8AE21BEA80FC00C5B690 /* CFURLAccess.h in Headers */,
1649+
F03A43181D4877DD00A7791E /* CFAsmMacros.h in Headers */,
16461650
5B7C8ACA1BEA80FC00C5B690 /* CFError.h in Headers */,
16471651
5B7C8AE91BEA81AC00C5B690 /* CFLocaleInternal.h in Headers */,
16481652
5B7C8AE61BEA81AC00C5B690 /* ForSwiftFoundationOnly.h in Headers */,

build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
private = [
138138
'CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h',
139139
'CoreFoundation/Base.subproj/ForFoundationOnly.h',
140+
'CoreFoundation/Base.subproj/CFAsmMacros.h',
140141
'CoreFoundation/String.subproj/CFBurstTrie.h',
141142
'CoreFoundation/Error.subproj/CFError_Private.h',
142143
'CoreFoundation/URL.subproj/CFURLPriv.h',

lib/phases.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ def generate(self):
139139
generated = """
140140
build """ + self.output.relative() + """: Assemble """ + self.path.relative() + self.generate_dependencies() + """
141141
flags = """
142+
generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
143+
generated += " -I" + Configuration.current.build_directory.relative()
144+
generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.ROOT_HEADERS_FOLDER_PATH
145+
generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.PUBLIC_HEADERS_FOLDER_PATH
146+
generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.PRIVATE_HEADERS_FOLDER_PATH
147+
generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative() + self.product.PROJECT_HEADERS_FOLDER_PATH
142148
asflags = TargetConditional.value(self.product.ASFLAGS)
143149
if asflags is not None:
144150
generated += " " + asflags

0 commit comments

Comments
 (0)