{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/25970","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/25970/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/25970/comments","events_url":"https://api.github.com/repos/golang/go/issues/25970/events","html_url":"https://github.com/golang/go/issues/25970","id":334059806,"node_id":"MDU6SXNzdWUzMzQwNTk4MDY=","number":25970,"title":"cmd/link: -buildmode=pie -linkshared generates incorrect code","user":{"login":"kiap","id":16517323,"node_id":"MDQ6VXNlcjE2NTE3MzIz","avatar_url":"https://avatars0.githubusercontent.com/u/16517323?v=4","gravatar_id":"","url":"https://api.github.com/users/kiap","html_url":"https://github.com/kiap","followers_url":"https://api.github.com/users/kiap/followers","following_url":"https://api.github.com/users/kiap/following{/other_user}","gists_url":"https://api.github.com/users/kiap/gists{/gist_id}","starred_url":"https://api.github.com/users/kiap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiap/subscriptions","organizations_url":"https://api.github.com/users/kiap/orgs","repos_url":"https://api.github.com/users/kiap/repos","events_url":"https://api.github.com/users/kiap/events{/privacy}","received_events_url":"https://api.github.com/users/kiap/received_events","type":"User","site_admin":false},"labels":[{"id":373402289,"node_id":"MDU6TGFiZWwzNzM0MDIyODk=","url":"https://api.github.com/repos/golang/go/labels/NeedsInvestigation","name":"NeedsInvestigation","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/62","html_url":"https://github.com/golang/go/milestone/62","labels_url":"https://api.github.com/repos/golang/go/milestones/62/labels","id":2827591,"node_id":"MDk6TWlsZXN0b25lMjgyNzU5MQ==","number":62,"title":"Go1.11","description":"","creator":{"login":"rsc","id":104030,"node_id":"MDQ6VXNlcjEwNDAzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":488,"closed_issues":600,"state":"open","created_at":"2017-10-10T13:39:17Z","updated_at":"2018-06-20T18:55:54Z","due_on":"2018-07-31T07:00:00Z","closed_at":null},"comments":1,"created_at":"2018-06-20T12:43:38Z","updated_at":"2018-06-20T18:55:54Z","closed_at":"2018-06-20T18:55:54Z","author_association":"NONE","body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n\r\n### What version of Go are you using (`go version`)?\r\ngo version go1.10.3 linux/amd64\r\n\r\n### Does this issue reproduce with the latest release?\r\nYes, even on Master and all branches since 1.10 (was working properly on 1.10)\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\nCentOS Linux release 7.5.1804 (Core)\r\nlibgcc-4.8.5-28.el7_5.1.i686\r\nlibgcc-4.8.5-28.el7_5.1.x86_64\r\ngcc-c++-4.8.5-28.el7_5.1.x86_64\r\ngcc-4.8.5-28.el7_5.1.x86_64\r\n\r\ngo env\r\n\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCACHE=\"/root/.cache/go-build\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"linux\"\r\nGOOS=\"linux\"\r\nGOPATH=\"/usr/src/dev\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/src/go\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/usr/src/go/pkg/tool/linux_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"gcc\"\r\nCXX=\"g++\"\r\nCGO_ENABLED=\"1\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build542819085=/tmp/go-build -gno-record-gcc-switches\"\r\n\r\n\r\n### What did you do?\r\n\r\nprog1: (simple)\r\nhttps://play.golang.org/p/GdPKpqF4jx1\r\n\r\nprog2:  (with goroutines)\r\nhttps://play.golang.org/p/Unoy--GQG87\r\n\r\nprog3: (simple with standard package)\r\nhttps://play.golang.org/p/rY3RgWfkWAo\r\n\r\ngo install -v -ldflags '-s -w' -gcflags '-trimpath /usr/src/go' -buildmode=shared -linkshared -pkgdir /usr/src/lib std\r\n\r\ngo install -v -ldflags '-s -w' -gcflags '-trimpath /usr/src/dev' -buildmode=pie -linkshared -pkgdir /usr/src/lib prog\r\n\r\nreplace prog with prog1 prog2 or prog3\r\n\r\nATTENTION:\r\nIf you compile normally without buildmode=shared -linkshared then it works properly like this\r\n\r\ngo install -v -ldflags '-s -w' -gcflags '-trimpath /usr/src/dev' -buildmode=pie prog\r\n\r\n\r\n### What did you expect to see?\r\n\r\nprog1:\r\n=====\r\nObject 0\r\nValue 46\r\nThis is a test 3.141950\r\nitest\r\nfinish\r\nlinux amd64 4\r\n ptr  p: 0xc4200101f0\r\n ptr *p: ciao\r\n      s: ciao\r\n     &s: 0xc4200101f0\r\n\r\n\r\n\r\nprog2:\r\n=====\r\n50000005000000\r\n0.005969\r\n00100010\r\n50000005000000\r\n0.011546\r\nbin/prog2\r\n9\r\n512\r\n\r\nprog3:\r\n=====\r\n\r\n[51 165 23 125 0 65 187 12 113 16 144 21 229 235 205 79 65 224 131 252 155 202 71 22 3 69 114 106 183 8 241 38 249 5 250 155 150 232 17 89 70 23 120 67 38 29 206 29]\r\n\r\n\r\n\r\n### What did you see instead?\r\n\r\nprog1:\r\n=====\r\n\r\nObject 0\r\nValue 46\r\nThis is a test 3.141950\r\nitest\r\nfinish\r\nlinux amd64 4\r\n ptr  p: 0xc4200101f0\r\n ptr *p: ciao\r\n      s: ciao\r\n     &s: 0xc4200101f0\r\n\r\n\r\n\r\n\r\n\r\nprog2:\r\n=====\r\nfatal error: makechan: invalid channel element type\r\n\r\ngoroutine 1 [running]:\r\nruntime.throw(0x7f4c3e856a16, 0x26)\r\n\t/usr/src/go/src/runtime/panic.go:616 +0x83 fp=0xc420365e10 sp=0xc420365df0 pc=0x7f4c3e224e13\r\nruntime.makechan(0x5608292e1020, 0x2, 0x7f4c3f282560)\r\n\t/usr/src/go/src/runtime/chan.go:75 +0x267 fp=0xc420365e50 sp=0xc420365e10 pc=0x7f4c3e1f48c7\r\nmain.main()\r\n\tsrc/prog2/main.go:25 +0x72 fp=0xc420365f88 sp=0xc420365e50 pc=0x5608290def42\r\nruntime.main()\r\n\t/usr/src/go/src/runtime/proc.go:198 +0x24f fp=0xc420365fe0 sp=0xc420365f88 pc=0x7f4c3e2275bf\r\nruntime.goexit()\r\n\t/usr/src/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420365fe8 sp=0xc420365fe0 pc=0x7f4c3e25c7c1\r\n\r\n\r\n\r\nprog3:\r\n=====\r\n\r\nruntime: out of memory: cannot allocate 7205794687101042688-byte block (3899392 in use)\r\nfatal error: out of memory\r\n\r\nruntime stack:\r\nruntime.throw(0x7f5ba58aeee3, 0xd)\r\n\t/usr/src/go/src/runtime/panic.go:616 +0x83\r\nruntime.largeAlloc(0x64002017090d8b48, 0x7f5ba52c0101, 0x7f5ba6e6f000)\r\n\t/usr/src/go/src/runtime/malloc.go:828 +0x112\r\nruntime.mallocgc.func1()\r\n\t/usr/src/go/src/runtime/malloc.go:721 +0x48\r\nruntime.systemstack(0x7f5b00000000)\r\n\t/usr/src/go/src/runtime/asm_amd64.s:409 +0x72\r\nruntime.mstart()\r\n\t/usr/src/go/src/runtime/proc.go:1175\r\n\r\ngoroutine 1 [running]:\r\nruntime.systemstack_switch()\r\n\t/usr/src/go/src/runtime/asm_amd64.s:363 fp=0xc420365e48 sp=0xc420365e40 pc=0x7f5ba52c7b50\r\nruntime.mallocgc(0x64002017090d8b48, 0x55f0b34418a0, 0x7f5ba5f77101, 0xc420374060)\r\n\t/usr/src/go/src/runtime/malloc.go:720 +0x909 fp=0xc420365ee8 sp=0xc420365e48 pc=0x7f5ba5273fa9\r\nruntime.convT2Eslice(0x55f0b34418a0, 0xc420365f60, 0x55f0b3441c02, 0xe)\r\n\t/usr/src/go/src/runtime/iface.go:384 +0x6b fp=0xc420365f18 sp=0xc420365ee8 pc=0x7f5ba527175b\r\nmain.main()\r\n\tsrc/prog3/main.go:17 +0x91 fp=0xc420365f88 sp=0xc420365f18 pc=0x55f0b3441a71\r\nruntime.main()\r\n\t/usr/src/go/src/runtime/proc.go:198 +0x24f fp=0xc420365fe0 sp=0xc420365f88 pc=0x7f5ba52955bf\r\nruntime.goexit()\r\n\t/usr/src/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420365fe8 sp=0xc420365fe0 pc=0x7f5ba52ca7c1"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/398859084","html_url":"https://github.com/golang/go/issues/25970#issuecomment-398859084","issue_url":"https://api.github.com/repos/golang/go/issues/25970","id":398859084,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODg1OTA4NA==","user":{"login":"kiap","id":16517323,"node_id":"MDQ6VXNlcjE2NTE3MzIz","avatar_url":"https://avatars0.githubusercontent.com/u/16517323?v=4","gravatar_id":"","url":"https://api.github.com/users/kiap","html_url":"https://github.com/kiap","followers_url":"https://api.github.com/users/kiap/followers","following_url":"https://api.github.com/users/kiap/following{/other_user}","gists_url":"https://api.github.com/users/kiap/gists{/gist_id}","starred_url":"https://api.github.com/users/kiap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiap/subscriptions","organizations_url":"https://api.github.com/users/kiap/orgs","repos_url":"https://api.github.com/users/kiap/repos","events_url":"https://api.github.com/users/kiap/events{/privacy}","received_events_url":"https://api.github.com/users/kiap/received_events","type":"User","site_admin":false},"created_at":"2018-06-20T18:55:54Z","updated_at":"2018-06-20T18:55:54Z","author_association":"NONE","body":"Just need to add that I tried All versions  since 1.9.6 on CentOS 6 and CentOS 7  latest releases and even previous code do not work when pie and linkshared are present, I believe an update to CentOS gcc or relevant libraries caused this, as it was working just fine, even previously working releases do not work with current updates on CentOS 6 and CentOS 7\r\n\r\nIt is not isolated to channels or goroutine with any large program you can reproduce this problem\r\n\r\nin example: https://play.golang.org/p/nZcaXvMBeiE\r\n"}}
{"actor":{"display_login":"kiap"}}