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 |
| 22 | @@ -1280,6 +1280,7 @@ func (ctxt *Link) hostlink() { |
| 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))) |
| 27 | if ctxt.HeadType != objabi.Hwindows { |
| 28 | // Pass -z nodelete to mark the shared library as |
| 29 | // non-closeable: a dlclose will do nothing. |
| 30 | @@ -1291,6 +1292,7 @@ func (ctxt *Link) hostlink() { |
| 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") |
| 38 | @@ -1299,6 +1301,7 @@ func (ctxt *Link) hostlink() { |
| 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 | |