Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From c034dceae17b7d8d437871afe5eba55a55434222 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Wed, 10 Oct 2018 00:48:31 +0200 |
| 4 | Subject: [PATCH] klibc-static-utils: do not build shared binaries |
| 5 | |
| 6 | We were building some shared utilities and this was leading to linker errors |
| 7 | for x86 with security flags enabled. |
| 8 | |
| 9 | Fix |
| 10 | i586-oe-linux-musl-ld.bfd: discarded output section: `.got.plt' |
| 11 | |
| 12 | Upstream-Status: Inappropriate [Embedded Specific] |
| 13 | |
| 14 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 15 | --- |
| 16 | usr/dash/Kbuild | 6 +----- |
| 17 | usr/kinit/Kbuild | 4 +--- |
| 18 | usr/kinit/fstype/Kbuild | 4 +--- |
| 19 | usr/kinit/ipconfig/Kbuild | 4 +--- |
| 20 | usr/kinit/nfsmount/Kbuild | 4 +--- |
| 21 | usr/kinit/resume/Kbuild | 5 +---- |
| 22 | usr/kinit/run-init/Kbuild | 5 +---- |
| 23 | usr/utils/Kbuild | 7 ++----- |
| 24 | 8 files changed, 9 insertions(+), 30 deletions(-) |
| 25 | |
| 26 | diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild |
| 27 | index 1a6920a..b3a4e64 100644 |
| 28 | --- a/usr/dash/Kbuild |
| 29 | +++ b/usr/dash/Kbuild |
| 30 | @@ -25,12 +25,8 @@ gen-h-files := builtins.h nodes.h syntax.h token.h |
| 31 | |
| 32 | static-y := sh |
| 33 | |
| 34 | -# The shared binary |
| 35 | -shared-y := sh.shared |
| 36 | -sh.shared-y := $(sh-y) |
| 37 | - |
| 38 | # For cleaning |
| 39 | -targets := sh sh.g sh.shared sh.shared.g $(gen-o-files) |
| 40 | +targets := sh sh.g $(gen-o-files) |
| 41 | |
| 42 | # explicit dependency for all generated files |
| 43 | $(addprefix $(obj)/, $(sh-y)): $(addprefix $(obj)/, $(gen-h-files)) |
| 44 | diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild |
| 45 | index f7fdccd..8db06ab 100644 |
| 46 | --- a/usr/kinit/Kbuild |
| 47 | +++ b/usr/kinit/Kbuild |
| 48 | @@ -18,8 +18,6 @@ kinit-y += fstype/ |
| 49 | kinit-y += resume/ |
| 50 | |
| 51 | static-y := kinit |
| 52 | -shared-y := kinit.shared |
| 53 | -kinit.shared-y := $(kinit-y) |
| 54 | |
| 55 | # Additional include paths files |
| 56 | KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \ |
| 57 | @@ -29,7 +27,7 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \ |
| 58 | -I$(srctree)/$(src)/run-init |
| 59 | |
| 60 | # Cleaning |
| 61 | -targets += kinit kinit.g kinit.shared kinit.shared.g |
| 62 | +targets += kinit kinit.g |
| 63 | subdir- := fstype ipconfig nfsmount resume run-init |
| 64 | |
| 65 | |
| 66 | diff --git a/usr/kinit/fstype/Kbuild b/usr/kinit/fstype/Kbuild |
| 67 | index 367611d..8d453ea 100644 |
| 68 | --- a/usr/kinit/fstype/Kbuild |
| 69 | +++ b/usr/kinit/fstype/Kbuild |
| 70 | @@ -3,7 +3,6 @@ |
| 71 | # |
| 72 | |
| 73 | static-y := static/fstype |
| 74 | -shared-y := shared/fstype |
| 75 | |
| 76 | # common .o files |
| 77 | objs := main.o fstype.o |
| 78 | @@ -16,8 +15,7 @@ lib-y := $(objs) |
| 79 | |
| 80 | # .o files used to built executables |
| 81 | static/fstype-y := $(objs) |
| 82 | -shared/fstype-y := $(objs) |
| 83 | |
| 84 | # Cleaning |
| 85 | -clean-dirs := static shared |
| 86 | +clean-dirs := static |
| 87 | |
| 88 | diff --git a/usr/kinit/ipconfig/Kbuild b/usr/kinit/ipconfig/Kbuild |
| 89 | index eb1d472..ef87e7e 100644 |
| 90 | --- a/usr/kinit/ipconfig/Kbuild |
| 91 | +++ b/usr/kinit/ipconfig/Kbuild |
| 92 | @@ -3,7 +3,6 @@ |
| 93 | # |
| 94 | |
| 95 | static-y := static/ipconfig |
| 96 | -shared-y := shared/ipconfig |
| 97 | |
| 98 | # common .o files |
| 99 | objs := main.o netdev.o packet.o |
| 100 | @@ -22,8 +21,7 @@ lib-y := $(objs) |
| 101 | |
| 102 | # .o files used to built executables |
| 103 | static/ipconfig-y := $(objs) |
| 104 | -shared/ipconfig-y := $(objs) |
| 105 | |
| 106 | # Cleaning |
| 107 | -clean-dirs := static shared |
| 108 | +clean-dirs := static |
| 109 | |
| 110 | diff --git a/usr/kinit/nfsmount/Kbuild b/usr/kinit/nfsmount/Kbuild |
| 111 | index ba31708..01bedce 100644 |
| 112 | --- a/usr/kinit/nfsmount/Kbuild |
| 113 | +++ b/usr/kinit/nfsmount/Kbuild |
| 114 | @@ -4,7 +4,6 @@ |
| 115 | |
| 116 | static-y := static/nfsmount |
| 117 | #FIXME - build is broken static-y := dummypmap |
| 118 | -shared-y := shared/nfsmount |
| 119 | |
| 120 | objs := main.o mount.o portmap.o dummypmap.o sunrpc.o |
| 121 | |
| 122 | @@ -13,7 +12,6 @@ lib-y := $(objs) |
| 123 | |
| 124 | # .o files used for executables |
| 125 | static/nfsmount-y := $(objs) |
| 126 | -shared/nfsmount-y := $(objs) |
| 127 | |
| 128 | # dummypmap uses a single .o file (rename src file?) |
| 129 | dummypmap-y := dummypmap_test.o |
| 130 | @@ -21,5 +19,5 @@ dummypmap-y := dummypmap_test.o |
| 131 | # TODO - do we want a stripped version |
| 132 | # TODO - do we want the static.g + shared.g directories? |
| 133 | |
| 134 | -clean-dirs := static shared |
| 135 | +clean-dirs := static |
| 136 | |
| 137 | diff --git a/usr/kinit/resume/Kbuild b/usr/kinit/resume/Kbuild |
| 138 | index c1342e1..15b9590 100644 |
| 139 | --- a/usr/kinit/resume/Kbuild |
| 140 | +++ b/usr/kinit/resume/Kbuild |
| 141 | @@ -3,7 +3,6 @@ |
| 142 | # |
| 143 | |
| 144 | static-y := static/resume |
| 145 | -shared-y := shared/resume |
| 146 | |
| 147 | # common .o files |
| 148 | objs := resume.o resumelib.o |
| 149 | @@ -20,9 +19,7 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/.. |
| 150 | # .o files used to built executables |
| 151 | static/resume-y := $(objs) |
| 152 | static/resume-lib := ../lib.a |
| 153 | -shared/resume-y := $(objs) |
| 154 | -shared/resume-lib := ../lib.a |
| 155 | |
| 156 | # Cleaning |
| 157 | -clean-dirs := static shared |
| 158 | +clean-dirs := static |
| 159 | |
| 160 | diff --git a/usr/kinit/run-init/Kbuild b/usr/kinit/run-init/Kbuild |
| 161 | index c153b0a..a1ea834 100644 |
| 162 | --- a/usr/kinit/run-init/Kbuild |
| 163 | +++ b/usr/kinit/run-init/Kbuild |
| 164 | @@ -3,7 +3,6 @@ |
| 165 | # |
| 166 | |
| 167 | static-y := static/run-init |
| 168 | -shared-y := shared/run-init |
| 169 | |
| 170 | # common .o files |
| 171 | objs := run-init.o runinitlib.o |
| 172 | @@ -24,9 +23,7 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/.. |
| 173 | # .o files used to built executables |
| 174 | static/run-init-y := $(objs) |
| 175 | static/run-init-lib := ../lib.a |
| 176 | -shared/run-init-y := $(objs) |
| 177 | -shared/run-init-lib := ../lib.a |
| 178 | |
| 179 | # Cleaning |
| 180 | -clean-dirs := static shared |
| 181 | +clean-dirs := static |
| 182 | |
| 183 | diff --git a/usr/utils/Kbuild b/usr/utils/Kbuild |
| 184 | index 67d9486..1573363 100644 |
| 185 | --- a/usr/utils/Kbuild |
| 186 | +++ b/usr/utils/Kbuild |
| 187 | @@ -7,7 +7,6 @@ progs += true false sleep ln mv nuke minips cat ls losetup |
| 188 | progs += uname halt kill readlink cpio sync dmesg |
| 189 | |
| 190 | static-y := $(addprefix static/, $(progs)) |
| 191 | -shared-y := $(addprefix shared/, $(progs)) |
| 192 | |
| 193 | # The binary is placed in a subdir, so we need to tell kbuild this |
| 194 | static/chroot-y := chroot.o |
| 195 | @@ -62,13 +61,11 @@ static/losetup-y := losetup.o |
| 196 | shared/losetup-y := losetup.o |
| 197 | |
| 198 | # Additionally linked targets |
| 199 | -always := static/reboot static/poweroff shared/reboot shared/poweroff |
| 200 | +always := static/reboot static/poweroff |
| 201 | |
| 202 | $(obj)/static/reboot $(obj)/static/poweroff: $(obj)/static/halt |
| 203 | $(call cmd,ln) |
| 204 | -$(obj)/shared/reboot $(obj)/shared/poweroff: $(obj)/shared/halt |
| 205 | - $(call cmd,ln) |
| 206 | |
| 207 | # Clean deletes the static and shared dir |
| 208 | -clean-dirs := static shared |
| 209 | +clean-dirs := static |
| 210 | |
| 211 | -- |
| 212 | 2.7.4 |
| 213 | |