Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From bf5cf5301ae5914498454c87293d1df2e1d8489f Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kube <alexander.j.kube@gmail.com> |
| 3 | Date: Wed, 23 Oct 2019 21:16:32 +0430 |
| 4 | Subject: [PATCH 4/9] ld: add soname to shareable objects |
| 5 | |
| 6 | so that OE's shared library dependency handling |
| 7 | can find them. |
| 8 | |
| 9 | Adapted to Go 1.13 from patches originally submitted to |
| 10 | the meta/recipes-devtools/go tree by |
| 11 | Matt Madison <matt@madison.systems>. |
| 12 | |
| 13 | Upstream-Status: Inappropriate [OE specific] |
| 14 | |
| 15 | Signed-off-by: Alexander J Kube <alexander.j.kube@gmail.com> |
| 16 | --- |
| 17 | src/cmd/link/internal/ld/lib.go | 3 +++ |
| 18 | 1 file changed, 3 insertions(+) |
| 19 | |
| 20 | --- a/src/cmd/link/internal/ld/lib.go |
| 21 | +++ b/src/cmd/link/internal/ld/lib.go |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 22 | @@ -1343,6 +1343,7 @@ func (ctxt *Link) hostlink() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | argv = append(argv, "-Wl,-z,relro") |
| 24 | } |
| 25 | argv = append(argv, "-shared") |
| 26 | + argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 27 | if ctxt.HeadType == objabi.Hwindows { |
| 28 | if *flagAslr { |
| 29 | argv = addASLRargs(argv) |
| 30 | @@ -1358,6 +1359,7 @@ func (ctxt *Link) hostlink() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 31 | argv = append(argv, "-Wl,-z,relro") |
| 32 | } |
| 33 | argv = append(argv, "-shared") |
| 34 | + argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) |
| 35 | case BuildModePlugin: |
| 36 | if ctxt.HeadType == objabi.Hdarwin { |
| 37 | argv = append(argv, "-dynamiclib") |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 38 | @@ -1366,6 +1368,7 @@ func (ctxt *Link) hostlink() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 39 | argv = append(argv, "-Wl,-z,relro") |
| 40 | } |
| 41 | argv = append(argv, "-shared") |
| 42 | + argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) |
| 43 | } |
| 44 | } |
| 45 | |