Skip to content

Strip i386 arch from tvOS compiler-rt lib (if present) #38262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

edymtt
Copy link
Contributor

@edymtt edymtt commented Jul 5, 2021

This is to avoid the following issue when generating toolchains for
macOS

ld: building for tvOS, but linking in object file built for tvOS
Simulator, file '/tmp/strip.mgCPcB' for architecture i386
fatal error:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip:
internal link edit command failed

This reverts commit 8470faf, #37929

Addresses rdar://80098850

This is to avoid the following issue when generating toolchains for
macOS

```
ld: building for tvOS, but linking in object file built for tvOS
Simulator, file '/tmp/strip.mgCPcB' for architecture i386
fatal error:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip:
internal link edit command failed
```

This reverts commit 8470faf, swiftlang#37929

Addresses rdar://80098850
@edymtt edymtt requested review from shahmishal and hyp July 5, 2021 17:53
@edymtt
Copy link
Contributor Author

edymtt commented Jul 5, 2021

@swift-ci please smoke test

@edymtt
Copy link
Contributor Author

edymtt commented Jul 5, 2021

@swift-ci please build toolchain

@shahmishal
Copy link
Member

From my understanding, this will not work with Xcode 13 beta. We currently have Xcode 13 beta on macOS toolchain bot and Xcode 12.3 on all other bots.

@shahmishal
Copy link
Member

If you don't mind, can you verify this change on both Xcode 12.3 and Xcode 13 beta 1?

@swift-ci
Copy link
Contributor

swift-ci commented Jul 5, 2021

Linux Toolchain (Ubuntu 16.04)
Download Toolchain
Git Sha - 245db53

Install command
tar zxf swift-PR-38262-619-ubuntu16.04.tar.gz
More info

@edymtt
Copy link
Contributor Author

edymtt commented Jul 5, 2021

@swift-ci please smoke test

@edymtt
Copy link
Contributor Author

edymtt commented Jul 5, 2021

@swift-ci please build toolchain

@edymtt
Copy link
Contributor Author

edymtt commented Jul 5, 2021

Doing a clean build locally with Xcode 13.0 beta 1 indeed exposed an issue around the copy of the libraries when the source library does not have the i386 slice to begin with.

I am still running the preset locally to ensure the change is sane, I will lean on CI to ensure the change still works with Xcode 12.3

@swift-ci
Copy link
Contributor

swift-ci commented Jul 5, 2021

Linux Toolchain (Ubuntu 16.04)
Download Toolchain
Git Sha - 376b6f2

Install command
tar zxf swift-PR-38262-620-ubuntu16.04.tar.gz
More info

@swift-ci
Copy link
Contributor

swift-ci commented Jul 6, 2021

macOS Toolchain
Download Toolchain
Git Sha - 376b6f2

Install command
tar -zxf swift-PR-38262-1041-osx.tar.gz --directory ~/

@shahmishal shahmishal merged commit 3a1a423 into swiftlang:main Jul 6, 2021
@shahmishal
Copy link
Member

@edymtt Can you also cherry-pick this on to 5.5 branch?

edymtt added a commit to edymtt/swift that referenced this pull request Jul 6, 2021
The previous logic could fail silently to copy the library if the i386
slice is not present in the first place (like it is the case for
`libclang_rt.tvos.a` in Xcode 13.0 beta 1) -- this will avoid errors
like

```
Undefined symbols for architecture arm64:
  "___isPlatformVersionAtLeast", referenced from:
    swift::initializeProtocolLookup() in ImageInspectionMachO.cpp.o
    swift::initializeProtocolConformanceLookup() in
ImageInspectionMachO.cpp.o
    swift::initializeTypeMetadataRecordLookup() in
ImageInspectionMachO.cpp.o
    swift::initializeDynamicReplacementLookup() in
ImageInspectionMachO.cpp.o
```

This is a backport of swiftlang#38262

Addresses rdar://80209915
@edymtt
Copy link
Contributor Author

edymtt commented Jul 6, 2021

Sure -- created #38275

@edymtt edymtt deleted the remove-i386-slice-compiler-rt-tvossim branch July 6, 2021 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants