{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/42889759","id":42889759,"diff_hunk":"@@ -63,7 +60,32 @@ pub fn opts() -> TargetOptions {\n \n             // Always enable DEP (NX bit) when it is available\n             \"-Wl,--nxcompat\".to_string(),\n+\n+            // Do not use the standard system startup files or libraries when linking\n+            \"-nostdlib\".to_string(),\n+        ),\n+        pre_link_objects_exe: vec!(\n+            \"crt2.o\".to_string(),\n+            \"rsbegin.o\".to_string(),\n+        ),\n+        pre_link_objects_dll: vec!(\n+            \"dllcrt2.o\".to_string(),\n+            \"rsbegin.o\".to_string(),\n+        ),\n+        late_link_args: vec!(\n+            \"-lmingwex\".to_string(),\n+            \"-lmingw32\".to_string(),\n+            \"-lgcc\".to_string(), // alas, mingw* libraries above depend on libgcc\n+            \"-lmsvcrt\".to_string(),\n+            \"-ladvapi32\".to_string(),\n+            \"-lshell32\".to_string(),\n+            \"-luser32\".to_string(),\n+            \"-lkernel32\".to_string(),","path":"src/librustc_back/target/windows_base.rs","position":36,"original_position":36,"commit_id":"d710f8ba1f2ef8b35d3603875b454955d2d2585c","original_commit_id":"145b8438fe19b81d964b60132eeeb6c95e8646e9","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"body":"In terms of intrinsically required libraries by the compiler, however, I don't these may want to not be in this list. These libraries are injected into all compilations ever for this target, and it can end up creating hidden dependencies and such (like in this case), when the \"most correct\" thing to do would probably be to only include those the compiler itself requires. I think we need mingw32/mingwex to build executables as crt2.o references some symbols from those, and then kernel32/msvcrt/gcc are dependencies of those libraries, so those are all required for dlls/exes. If libflate is the one, though, that depends on advapi32 or user32, then libflate itself should declare that I think (it should also in theory declare that it depends on mingwex).\r\n\r\nThat being said, though, we probably want to just link these into the standard library (e.g. add -luser32 which I think may be missing today) and we should already be covered by -ladvapi32 in the standard library?","created_at":"2015-10-23T17:15:12Z","updated_at":"2015-10-23T17:15:12Z","html_url":"https://github.com/rust-lang/rust/pull/29177#discussion_r42889759","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/29177","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/42889759"},"html":{"href":"https://github.com/rust-lang/rust/pull/29177#discussion_r42889759"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/29177"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/29177","id":48148784,"html_url":"https://github.com/rust-lang/rust/pull/29177","diff_url":"https://github.com/rust-lang/rust/pull/29177.diff","patch_url":"https://github.com/rust-lang/rust/pull/29177.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/29177","number":29177,"state":"open","locked":false,"title":"Remove dependency on libgcc-dw2-1.dll from win32 executables.","user":{"login":"vadimcn","id":3203809,"avatar_url":"https://avatars.githubusercontent.com/u/3203809?v=3","gravatar_id":"","url":"https://api.github.com/users/vadimcn","html_url":"https://github.com/vadimcn","followers_url":"https://api.github.com/users/vadimcn/followers","following_url":"https://api.github.com/users/vadimcn/following{/other_user}","gists_url":"https://api.github.com/users/vadimcn/gists{/gist_id}","starred_url":"https://api.github.com/users/vadimcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadimcn/subscriptions","organizations_url":"https://api.github.com/users/vadimcn/orgs","repos_url":"https://api.github.com/users/vadimcn/repos","events_url":"https://api.github.com/users/vadimcn/events{/privacy}","received_events_url":"https://api.github.com/users/vadimcn/received_events","type":"User","site_admin":false},"body":"Note: for now, this change only affects `-windows-gnu` builds.\r\n\r\nSo why was this `libgcc` dylib dependency needed in the first place?\r\nThe stack unwinder needs to know about locations of unwind tables of all the modules loaded in the current process.  The easiest portable way of achieving this is to have each module register itself with the unwinder when loaded into the process.  All modules compiled by GCC do this by calling the __register_frame_info() in their startup code (that's `crtbegin.o` and `crtend.o`, which are automatically linked into any gcc output).\r\nAnother important piece is that there should be only one copy of the unwinder (and thus unwind tables registry) in the process.  This pretty much means that the unwinder must be in a shared library (unless everything is statically linked). \r\n\r\nNow, Rust compiler tries very hard to make sure that any given Rust crate appears in the final output just once.   So if we link the unwinder statically to one of Rust's crates, everything should be fine.\r\n\r\nUnfortunately, GCC startup objects are built under assumption that `libgcc` is the one true place for the unwind info registry, so I couldn't find any better way than to replace them.  So out go `crtbegin`/`crtend`, in come `rsbegin`/`rsend`!  \r\n\r\nA side benefit of this change is that rustc is now more in control of the command line that goes to the linker, so we could stop using `gcc` as the linker driver and just invoke `ld` directly.\r\n","created_at":"2015-10-20T02:00:07Z","updated_at":"2015-10-23T17:15:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51fe335ff1de5a197c904ad9f2e895ec9ad50b72","assignee":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/29177/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/29177/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/29177/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/d710f8ba1f2ef8b35d3603875b454955d2d2585c","head":{"label":"vadimcn:rtstuff","ref":"rtstuff","sha":"d710f8ba1f2ef8b35d3603875b454955d2d2585c","user":{"login":"vadimcn","id":3203809,"avatar_url":"https://avatars.githubusercontent.com/u/3203809?v=3","gravatar_id":"","url":"https://api.github.com/users/vadimcn","html_url":"https://github.com/vadimcn","followers_url":"https://api.github.com/users/vadimcn/followers","following_url":"https://api.github.com/users/vadimcn/following{/other_user}","gists_url":"https://api.github.com/users/vadimcn/gists{/gist_id}","starred_url":"https://api.github.com/users/vadimcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadimcn/subscriptions","organizations_url":"https://api.github.com/users/vadimcn/orgs","repos_url":"https://api.github.com/users/vadimcn/repos","events_url":"https://api.github.com/users/vadimcn/events{/privacy}","received_events_url":"https://api.github.com/users/vadimcn/received_events","type":"User","site_admin":false},"repo":{"id":10638165,"name":"rust","full_name":"vadimcn/rust","owner":{"login":"vadimcn","id":3203809,"avatar_url":"https://avatars.githubusercontent.com/u/3203809?v=3","gravatar_id":"","url":"https://api.github.com/users/vadimcn","html_url":"https://github.com/vadimcn","followers_url":"https://api.github.com/users/vadimcn/followers","following_url":"https://api.github.com/users/vadimcn/following{/other_user}","gists_url":"https://api.github.com/users/vadimcn/gists{/gist_id}","starred_url":"https://api.github.com/users/vadimcn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadimcn/subscriptions","organizations_url":"https://api.github.com/users/vadimcn/orgs","repos_url":"https://api.github.com/users/vadimcn/repos","events_url":"https://api.github.com/users/vadimcn/events{/privacy}","received_events_url":"https://api.github.com/users/vadimcn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vadimcn/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/vadimcn/rust","forks_url":"https://api.github.com/repos/vadimcn/rust/forks","keys_url":"https://api.github.com/repos/vadimcn/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vadimcn/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vadimcn/rust/teams","hooks_url":"https://api.github.com/repos/vadimcn/rust/hooks","issue_events_url":"https://api.github.com/repos/vadimcn/rust/issues/events{/number}","events_url":"https://api.github.com/repos/vadimcn/rust/events","assignees_url":"https://api.github.com/repos/vadimcn/rust/assignees{/user}","branches_url":"https://api.github.com/repos/vadimcn/rust/branches{/branch}","tags_url":"https://api.github.com/repos/vadimcn/rust/tags","blobs_url":"https://api.github.com/repos/vadimcn/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vadimcn/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vadimcn/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/vadimcn/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vadimcn/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/vadimcn/rust/languages","stargazers_url":"https://api.github.com/repos/vadimcn/rust/stargazers","contributors_url":"https://api.github.com/repos/vadimcn/rust/contributors","subscribers_url":"https://api.github.com/repos/vadimcn/rust/subscribers","subscription_url":"https://api.github.com/repos/vadimcn/rust/subscription","commits_url":"https://api.github.com/repos/vadimcn/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/vadimcn/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/vadimcn/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/vadimcn/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/vadimcn/rust/contents/{+path}","compare_url":"https://api.github.com/repos/vadimcn/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vadimcn/rust/merges","archive_url":"https://api.github.com/repos/vadimcn/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vadimcn/rust/downloads","issues_url":"https://api.github.com/repos/vadimcn/rust/issues{/number}","pulls_url":"https://api.github.com/repos/vadimcn/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/vadimcn/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/vadimcn/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vadimcn/rust/labels{/name}","releases_url":"https://api.github.com/repos/vadimcn/rust/releases{/id}","created_at":"2013-06-12T07:24:01Z","updated_at":"2015-09-25T05:53:21Z","pushed_at":"2015-10-23T16:35:37Z","git_url":"git://github.com/vadimcn/rust.git","ssh_url":"git@github.com:vadimcn/rust.git","clone_url":"https://github.com/vadimcn/rust.git","svn_url":"https://github.com/vadimcn/rust","homepage":"http://www.rust-lang.org","size":326925,"stargazers_count":1,"watchers_count":1,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"22581599819c2384dc2663999ab033cb7d5a0ac3","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"A safe, concurrent, practical language.","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","created_at":"2010-06-16T20:39:03Z","updated_at":"2015-10-23T15:59:17Z","pushed_at":"2015-10-23T16:53:41Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"http://www.rust-lang.org","size":698618,"stargazers_count":13906,"watchers_count":13906,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2702,"mirror_url":null,"open_issues_count":2300,"forks":2702,"open_issues":2300,"watchers":13906,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/29177"},"html":{"href":"https://github.com/rust-lang/rust/pull/29177"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/29177"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/29177/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/29177/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/29177/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/d710f8ba1f2ef8b35d3603875b454955d2d2585c"}}}}