{"action":"created","comment":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments/60471279","id":60471279,"diff_hunk":"@@ -216,6 +216,24 @@ void CodeGenerator::emit(Module *m) {\n       emitSymbolAddrGlobal(ir_->module, \"__bss_start\", \"_d_execBssBegAddr\");\n       emitSymbolAddrGlobal(ir_->module, \"_end\", \"_d_execBssEndAddr\");\n     }\n+\n+    // On Android, bracket TLS data with the symbols _tlsstart and _tlsend, as\n+    // done with dmd\n+    if (global.params.targetTriple.getEnvironment() == llvm::Triple::Android) {\n+      auto startSymbol = new llvm::GlobalVariable(\n+          ir_->module, llvm::Type::getInt32Ty(ir_->module.getContext()), false,\n+          llvm::GlobalValue::ExternalLinkage,\n+          llvm::ConstantInt::get(ir_->module.getContext(), APInt(32,0)),\n+          \"_tlsstart\", &*(ir_->module.global_begin()));\n+      startSymbol->setSection(\".tdata\");\n+\n+      auto endSymbol = new llvm::GlobalVariable(\n+          ir_->module, llvm::Type::getInt32Ty(ir_->module.getContext()), false,\n+          llvm::GlobalValue::ExternalLinkage,\n+          llvm::ConstantInt::get(ir_->module.getContext(), APInt(32,0)),\n+          \"_tlsend\");\n+      endSymbol->setSection(\".tcommon\");\n+    }","path":"driver/codegenerator.cpp","position":21,"original_position":21,"commit_id":"ee8a832c49332c66a8d118f17cf62e8ef464db39","original_commit_id":"ee8a832c49332c66a8d118f17cf62e8ef464db39","user":{"login":"joakim-noah","id":5930876,"avatar_url":"https://avatars.githubusercontent.com/u/5930876?v=3","gravatar_id":"","url":"https://api.github.com/users/joakim-noah","html_url":"https://github.com/joakim-noah","followers_url":"https://api.github.com/users/joakim-noah/followers","following_url":"https://api.github.com/users/joakim-noah/following{/other_user}","gists_url":"https://api.github.com/users/joakim-noah/gists{/gist_id}","starred_url":"https://api.github.com/users/joakim-noah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakim-noah/subscriptions","organizations_url":"https://api.github.com/users/joakim-noah/orgs","repos_url":"https://api.github.com/users/joakim-noah/repos","events_url":"https://api.github.com/users/joakim-noah/events{/privacy}","received_events_url":"https://api.github.com/users/joakim-noah/received_events","type":"User","site_admin":false},"body":"No and yes, `_tlsstart` depends on the ELF object with the main function being passed first to the linker, which, for example, the scripts that produce the test runners don't do.  I don't know about linking at the IR level.  `_tlsend` should always be at the end because of the ld.bfd linker script that puts `.tcommon` last.","created_at":"2016-04-20T19:22:32Z","updated_at":"2016-04-20T19:22:32Z","html_url":"https://github.com/ldc-developers/ldc/pull/1447#discussion_r60471279","pull_request_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447","_links":{"self":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments/60471279"},"html":{"href":"https://github.com/ldc-developers/ldc/pull/1447#discussion_r60471279"},"pull_request":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447"}}},"pull_request":{"url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447","id":66973194,"html_url":"https://github.com/ldc-developers/ldc/pull/1447","diff_url":"https://github.com/ldc-developers/ldc/pull/1447.diff","patch_url":"https://github.com/ldc-developers/ldc/pull/1447.patch","issue_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1447","number":1447,"state":"closed","locked":false,"title":"Add a handful of fixes for Android","user":{"login":"joakim-noah","id":5930876,"avatar_url":"https://avatars.githubusercontent.com/u/5930876?v=3","gravatar_id":"","url":"https://api.github.com/users/joakim-noah","html_url":"https://github.com/joakim-noah","followers_url":"https://api.github.com/users/joakim-noah/followers","following_url":"https://api.github.com/users/joakim-noah/following{/other_user}","gists_url":"https://api.github.com/users/joakim-noah/gists{/gist_id}","starred_url":"https://api.github.com/users/joakim-noah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakim-noah/subscriptions","organizations_url":"https://api.github.com/users/joakim-noah/orgs","repos_url":"https://api.github.com/users/joakim-noah/repos","events_url":"https://api.github.com/users/joakim-noah/events{/privacy}","received_events_url":"https://api.github.com/users/joakim-noah/received_events","type":"User","site_admin":false},"body":"I finally matched the way dmd packs emulated TLS data with ldc, see below for more comments.","created_at":"2016-04-19T07:43:21Z","updated_at":"2016-04-20T19:22:32Z","closed_at":"2016-04-20T18:40:24Z","merged_at":"2016-04-20T18:40:24Z","merge_commit_sha":"f9678498ca138e1064b3062b3d3a20f2e6dacd18","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447/commits","review_comments_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447/comments","review_comment_url":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/issues/1447/comments","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/ee8a832c49332c66a8d118f17cf62e8ef464db39","head":{"label":"ldc-developers:android","ref":"android","sha":"ee8a832c49332c66a8d118f17cf62e8ef464db39","user":{"login":"ldc-developers","id":960112,"avatar_url":"https://avatars.githubusercontent.com/u/960112?v=3","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"repo":{"id":2174666,"name":"ldc","full_name":"ldc-developers/ldc","owner":{"login":"ldc-developers","id":960112,"avatar_url":"https://avatars.githubusercontent.com/u/960112?v=3","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ldc-developers/ldc","description":"The LLVM-based D compiler.","fork":false,"url":"https://api.github.com/repos/ldc-developers/ldc","forks_url":"https://api.github.com/repos/ldc-developers/ldc/forks","keys_url":"https://api.github.com/repos/ldc-developers/ldc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ldc-developers/ldc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ldc-developers/ldc/teams","hooks_url":"https://api.github.com/repos/ldc-developers/ldc/hooks","issue_events_url":"https://api.github.com/repos/ldc-developers/ldc/issues/events{/number}","events_url":"https://api.github.com/repos/ldc-developers/ldc/events","assignees_url":"https://api.github.com/repos/ldc-developers/ldc/assignees{/user}","branches_url":"https://api.github.com/repos/ldc-developers/ldc/branches{/branch}","tags_url":"https://api.github.com/repos/ldc-developers/ldc/tags","blobs_url":"https://api.github.com/repos/ldc-developers/ldc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ldc-developers/ldc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ldc-developers/ldc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ldc-developers/ldc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/{sha}","languages_url":"https://api.github.com/repos/ldc-developers/ldc/languages","stargazers_url":"https://api.github.com/repos/ldc-developers/ldc/stargazers","contributors_url":"https://api.github.com/repos/ldc-developers/ldc/contributors","subscribers_url":"https://api.github.com/repos/ldc-developers/ldc/subscribers","subscription_url":"https://api.github.com/repos/ldc-developers/ldc/subscription","commits_url":"https://api.github.com/repos/ldc-developers/ldc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ldc-developers/ldc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ldc-developers/ldc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ldc-developers/ldc/contents/{+path}","compare_url":"https://api.github.com/repos/ldc-developers/ldc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ldc-developers/ldc/merges","archive_url":"https://api.github.com/repos/ldc-developers/ldc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ldc-developers/ldc/downloads","issues_url":"https://api.github.com/repos/ldc-developers/ldc/issues{/number}","pulls_url":"https://api.github.com/repos/ldc-developers/ldc/pulls{/number}","milestones_url":"https://api.github.com/repos/ldc-developers/ldc/milestones{/number}","notifications_url":"https://api.github.com/repos/ldc-developers/ldc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ldc-developers/ldc/labels{/name}","releases_url":"https://api.github.com/repos/ldc-developers/ldc/releases{/id}","deployments_url":"https://api.github.com/repos/ldc-developers/ldc/deployments","created_at":"2011-08-08T17:10:27Z","updated_at":"2016-04-19T20:21:14Z","pushed_at":"2016-04-20T18:40:27Z","git_url":"git://github.com/ldc-developers/ldc.git","ssh_url":"git@github.com:ldc-developers/ldc.git","clone_url":"https://github.com/ldc-developers/ldc.git","svn_url":"https://github.com/ldc-developers/ldc","homepage":"http://wiki.dlang.org/LDC","size":28105,"stargazers_count":448,"watchers_count":448,"language":"D","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":94,"mirror_url":null,"open_issues_count":174,"forks":94,"open_issues":174,"watchers":448,"default_branch":"master"}},"base":{"label":"ldc-developers:ltsmaster","ref":"ltsmaster","sha":"4a8b4973264365e94ade9e41afaa969f930b6330","user":{"login":"ldc-developers","id":960112,"avatar_url":"https://avatars.githubusercontent.com/u/960112?v=3","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"repo":{"id":2174666,"name":"ldc","full_name":"ldc-developers/ldc","owner":{"login":"ldc-developers","id":960112,"avatar_url":"https://avatars.githubusercontent.com/u/960112?v=3","gravatar_id":"","url":"https://api.github.com/users/ldc-developers","html_url":"https://github.com/ldc-developers","followers_url":"https://api.github.com/users/ldc-developers/followers","following_url":"https://api.github.com/users/ldc-developers/following{/other_user}","gists_url":"https://api.github.com/users/ldc-developers/gists{/gist_id}","starred_url":"https://api.github.com/users/ldc-developers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldc-developers/subscriptions","organizations_url":"https://api.github.com/users/ldc-developers/orgs","repos_url":"https://api.github.com/users/ldc-developers/repos","events_url":"https://api.github.com/users/ldc-developers/events{/privacy}","received_events_url":"https://api.github.com/users/ldc-developers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ldc-developers/ldc","description":"The LLVM-based D compiler.","fork":false,"url":"https://api.github.com/repos/ldc-developers/ldc","forks_url":"https://api.github.com/repos/ldc-developers/ldc/forks","keys_url":"https://api.github.com/repos/ldc-developers/ldc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ldc-developers/ldc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ldc-developers/ldc/teams","hooks_url":"https://api.github.com/repos/ldc-developers/ldc/hooks","issue_events_url":"https://api.github.com/repos/ldc-developers/ldc/issues/events{/number}","events_url":"https://api.github.com/repos/ldc-developers/ldc/events","assignees_url":"https://api.github.com/repos/ldc-developers/ldc/assignees{/user}","branches_url":"https://api.github.com/repos/ldc-developers/ldc/branches{/branch}","tags_url":"https://api.github.com/repos/ldc-developers/ldc/tags","blobs_url":"https://api.github.com/repos/ldc-developers/ldc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ldc-developers/ldc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ldc-developers/ldc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ldc-developers/ldc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ldc-developers/ldc/statuses/{sha}","languages_url":"https://api.github.com/repos/ldc-developers/ldc/languages","stargazers_url":"https://api.github.com/repos/ldc-developers/ldc/stargazers","contributors_url":"https://api.github.com/repos/ldc-developers/ldc/contributors","subscribers_url":"https://api.github.com/repos/ldc-developers/ldc/subscribers","subscription_url":"https://api.github.com/repos/ldc-developers/ldc/subscription","commits_url":"https://api.github.com/repos/ldc-developers/ldc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ldc-developers/ldc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ldc-developers/ldc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ldc-developers/ldc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ldc-developers/ldc/contents/{+path}","compare_url":"https://api.github.com/repos/ldc-developers/ldc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ldc-developers/ldc/merges","archive_url":"https://api.github.com/repos/ldc-developers/ldc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ldc-developers/ldc/downloads","issues_url":"https://api.github.com/repos/ldc-developers/ldc/issues{/number}","pulls_url":"https://api.github.com/repos/ldc-developers/ldc/pulls{/number}","milestones_url":"https://api.github.com/repos/ldc-developers/ldc/milestones{/number}","notifications_url":"https://api.github.com/repos/ldc-developers/ldc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ldc-developers/ldc/labels{/name}","releases_url":"https://api.github.com/repos/ldc-developers/ldc/releases{/id}","deployments_url":"https://api.github.com/repos/ldc-developers/ldc/deployments","created_at":"2011-08-08T17:10:27Z","updated_at":"2016-04-19T20:21:14Z","pushed_at":"2016-04-20T18:40:27Z","git_url":"git://github.com/ldc-developers/ldc.git","ssh_url":"git@github.com:ldc-developers/ldc.git","clone_url":"https://github.com/ldc-developers/ldc.git","svn_url":"https://github.com/ldc-developers/ldc","homepage":"http://wiki.dlang.org/LDC","size":28105,"stargazers_count":448,"watchers_count":448,"language":"D","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":94,"mirror_url":null,"open_issues_count":174,"forks":94,"open_issues":174,"watchers":448,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447"},"html":{"href":"https://github.com/ldc-developers/ldc/pull/1447"},"issue":{"href":"https://api.github.com/repos/ldc-developers/ldc/issues/1447"},"comments":{"href":"https://api.github.com/repos/ldc-developers/ldc/issues/1447/comments"},"review_comments":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447/comments"},"review_comment":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ldc-developers/ldc/pulls/1447/commits"},"statuses":{"href":"https://api.github.com/repos/ldc-developers/ldc/statuses/ee8a832c49332c66a8d118f17cf62e8ef464db39"}}}}