Skip to content

utils: require gold on Linux targets #2609

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
merged 1 commit into from
May 24, 2016

Conversation

compnerd
Copy link
Member

What's in this pull request?

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
OS X platform @swift-ci Please test OS X platform
Linux platform @swift-ci Please test Linux platform

Note: Only members of the Apple organization can trigger swift-ci.

Given the discussion on swift-dev, and no opposition, swift the linux targets to
using gold by default.

@compnerd
Copy link
Member Author

CC @jckarter @modocache

@modocache
Copy link
Contributor

@swift-ci please test

@gribozavr
Copy link
Contributor

@swift-ci Please test

@gribozavr
Copy link
Contributor

CC @bryanpkc @antonblanchard How does this affect s390x and powerpc64le?

@bryanpkc
Copy link
Contributor

@gribozavr Thanks for the heads-up. gold support on s390x is included in the latest version of binutils, but is not yet shipped by most Linux distributions. Let me build binutils and test the Swift build.

@modocache
Copy link
Contributor

Both OS X and Linux failed with two separate failing tests, and both are unrelated. (Also, @shahmishal, I'm still unable to trigger CI. Hasn't worked for about a week now.)

@shahmishal
Copy link
Member

@modocache Are you able to only trigger on your own PR?

@shahmishal
Copy link
Member

@modocache Can you please try again? It should let you trigger CI on others PR.

@modocache
Copy link
Contributor

@shahmishal Thanks!! Whatever you did worked, I was able to trigger CI on #2549 (comment) :)

@shahmishal
Copy link
Member

@modocache Sorry for the trouble! Thanks!

@compnerd
Copy link
Member Author

The test failure seem unrelated to this change.

@RLovelett
Copy link
Contributor

Does this change the driver to use the gold linker too? If it doesn't then I think applications compiled by Swift will use the BFD linker instead of gold.

Given the discussion on swift-dev, and no opposition, swift the linux targets to
using gold by default.
@compnerd
Copy link
Member Author

@RLovelett I believe it does support the explicit linker specification, but updated the patch to default x86_64, ppc64, ppc64le to gold as well.

case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
// BFD linker has issues wrt relocations against protected symbols.
return "gold";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In light of what this change is proposing to do, switch to the gold linker by default on Linux, it might be worthwhile to wholly re-write this code.

What I mean is the default should be "gold" and then any thing that wants different should opt-out. Something more like:

std::string toolchains::GenericUnix::getDefaultLinker() const {
  switch(getTriple().getArch()) {
  default:
    // Otherwise, use the gold linker.
    return "gold";
  }
}

Also something that I noticed when changing the patch is that the toolchain is for GenericUnix does that mean this changes things for BSD? Is that OK?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its an ELF thing rather than a Linux thing, so I think that the current change as proposed makes sense. However, Id rather leave the structure as is (I explicitly split up the switch as the reasoning is different). That said, we could change the structure in a follow up change as well if others feel that is a good idea.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for considering this in a follow-up pull request.

@modocache
Copy link
Contributor

@bryanpkc friendly ping! :) Assuming this isn't problematic for s390x and powerpc64le, I'd like to go ahead and merge this change.

@swift-ci please test

@antonblanchard
Copy link
Contributor

Thanks @gribozavr ppc64le has gold support. I built and tested with this commit and it looks good.

@modocache
Copy link
Contributor

TestFoundation/TestNSJSONSerialization.swift has been failing for a few days now, it's unrelated.

@bryanpkc
Copy link
Contributor

@modocache I built gold from binutils-2.26 on s390x and tested this commit (adapting it for s390x). No obvious problem was found.

@modocache modocache merged commit 7218c41 into swiftlang:master May 24, 2016
@modocache
Copy link
Contributor

Great! Thanks everyone. :)

@rintaro
Copy link
Member

rintaro commented May 26, 2016

Seems like, this change introduced some link error in XCTest test.
#2718
https://ci.swift.org/job/swift-PR-Linux/1803/console

/tmp/tmpzVURwO/Misuse: error while loading shared libraries: libFoundation.so: cannot open shared object file: No such file or directory

With my local tests, reverting this change fixes the problem.

@RLovelett
Copy link
Contributor

@rintaro my personal nightly builds started failing with this same issue. The integration tests catch it for me on my system.

I have not yet had time to track down the problem to get a fix.

@modocache
Copy link
Contributor

Gah, sorry about that. I'm looking into the XCTest failure now. @swift-ci wouldn't have caught this one, for two reasons:

  1. swift-corelibs-xctest tests are not run in the apple/swift test suite
  2. TestFoundation/TestNSJSONSerialization.swift was failing, which would have stopped the test suite prior to swift-corelibs-xctest tests being run

@RLovelett
Copy link
Contributor

No problem. I'm glad it is being looked into.

Can you just put a link in this thread whenever you put up a fix? That way I can test it locally too.

modocache added a commit to modocache/swift-corelibs-xctest that referenced this pull request May 26, 2016
swiftlang/swift#2609 introduced a change to
the default behavior of the Swift driver, which now uses the gold
linker unless specified otherwise. This caused a linker error in
swift-corelibs-xctest's test suite, which this commit fixes.
@modocache
Copy link
Contributor

Fix for XCTest here: swiftlang/swift-corelibs-xctest#118. Sorry for the inconvenience everyone! 🙇

@modocache
Copy link
Contributor

@RLovelett @rintaro I merged swiftlang/swift-corelibs-xctest#118, which should fix the problem. Sorry again!

@RLovelett
Copy link
Contributor

Sadly the build still is not working again. Though that issue is resolved. Thanks again @modocache!

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.

8 participants