Skip to content

build: ensure that Windows is built without PIC #6407

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
Dec 20, 2016

Conversation

compnerd
Copy link
Member

PIC on windows does not make sense. All code is position independent.
Currently clang and LLVM do the wrong thing and generate ELF style PIC
code on Windows when -fPIC is used. Add -fno-pic to disable that
when cross-compiling to Windows.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

PIC on windows does not make sense.  All code is position independent.
Currently clang and LLVM do the wrong thing and generate ELF style PIC
code on Windows when `-fPIC` is used.  Add `-fno-pic` to disable that
when cross-compiling to Windows.
@compnerd
Copy link
Member Author

@swift-ci please test and merge

@compnerd
Copy link
Member Author

CC @hughbe

swift on Windows lives once more (with PR #6239)!

@swift-ci swift-ci merged commit 721d670 into swiftlang:master Dec 20, 2016
@jckarter
Copy link
Contributor

Not a review, but just a musing—even though PIC isn't the natural way of things for C code on Windows, there could be benefits to using a PIC/PIE-ish linkage model for Swift modules, since even with VM pager support for slid pages, there's still a nonzero cost to sliding and keeping resident multiple differently-slid copies of a page when an executable or DLL needs to be rebased. I suppose COFF objects might not have rich enough relocations for it, but it seems to me you could in theory craft a PE image with all the external references centralized to a GOT and PLT similar to ELF or Mach-O.

@compnerd compnerd deleted the windows-pic branch September 29, 2017 04:54
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