diff options
Diffstat (limited to 'meta/recipes-core/busybox')
3 files changed, 148 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch b/meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch new file mode 100644 index 0000000000..2bf2b91c7e --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch | |||
@@ -0,0 +1,114 @@ | |||
1 | From a9333eb6a7b8dbda735947cd5bc981ff9352a2c9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nathan Phillip Brink <ohnobinki@ohnopublishing.net> | ||
3 | Date: Thu, 10 Mar 2011 00:27:08 -0500 | ||
4 | Subject: [PATCH 1/2] Use $(CC) when linking instead of $(LD) and use $(CFLAGS) | ||
5 | and $(EXTRA_CFLAGS) when linking. | ||
6 | |||
7 | This fixes the issue where LDFLAGS escaped with -Wl are ignored during | ||
8 | compilation. It also simplifies using CFLAGS or EXTRA_CFLAGS (such as | ||
9 | -m32 on x86_64 or -flto) which apply to both compilation and linking | ||
10 | situations. | ||
11 | |||
12 | Signed-off-by: Nathan Phillip Brink <ohnobinki@ohnopublishing.net> | ||
13 | --- | ||
14 | Upstream-Status: Pending | ||
15 | |||
16 | Makefile | 7 ++++--- | ||
17 | scripts/Makefile.build | 8 ++++---- | ||
18 | scripts/Makefile.lib | 13 +++---------- | ||
19 | 3 files changed, 11 insertions(+), 17 deletions(-) | ||
20 | |||
21 | Index: busybox-1.23.2/Makefile | ||
22 | =================================================================== | ||
23 | --- busybox-1.23.2.orig/Makefile | ||
24 | +++ busybox-1.23.2/Makefile | ||
25 | @@ -309,7 +309,8 @@ CHECKFLAGS := -D__linux__ -Dlinux -D | ||
26 | MODFLAGS = -DMODULE | ||
27 | CFLAGS_MODULE = $(MODFLAGS) | ||
28 | AFLAGS_MODULE = $(MODFLAGS) | ||
29 | -LDFLAGS_MODULE = -r | ||
30 | +LDFLAGS_RELOCATABLE = -r -nostdlib | ||
31 | +LDFLAGS_MODULE = $(LDFLAGS_RELOCATABLE) | ||
32 | CFLAGS_KERNEL = | ||
33 | AFLAGS_KERNEL = | ||
34 | |||
35 | @@ -331,7 +332,7 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL) | ||
36 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ | ||
37 | ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ | ||
38 | CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ | ||
39 | - HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | ||
40 | + HOSTCXX HOSTCXXFLAGS LDFLAGS_RELOCATABLE LDFLAGS_MODULE CHECK CHECKFLAGS | ||
41 | |||
42 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | ||
43 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | ||
44 | @@ -610,7 +611,7 @@ quiet_cmd_busybox__ ?= LINK $@ | ||
45 | cmd_busybox__ ?= $(srctree)/scripts/trylink \ | ||
46 | "$@" \ | ||
47 | "$(CC)" \ | ||
48 | - "$(CFLAGS) $(CFLAGS_busybox)" \ | ||
49 | + "$(CFLAGS) $(CFLAGS_busybox) $(EXTRA_CFLAGS)" \ | ||
50 | "$(LDFLAGS) $(EXTRA_LDFLAGS)" \ | ||
51 | "$(core-y)" \ | ||
52 | "$(libs-y)" \ | ||
53 | Index: busybox-1.23.2/scripts/Makefile.build | ||
54 | =================================================================== | ||
55 | --- busybox-1.23.2.orig/scripts/Makefile.build | ||
56 | +++ busybox-1.23.2/scripts/Makefile.build | ||
57 | @@ -174,7 +174,7 @@ cmd_modversions = \ | ||
58 | | $(GENKSYMS) -a $(ARCH) \ | ||
59 | > $(@D)/.tmp_$(@F:.o=.ver); \ | ||
60 | \ | ||
61 | - $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | ||
62 | + $(CC) $(ld_flags_partial) $(LDFLAGS_RELOCATABLE) -o $@ $(@D)/.tmp_$(@F) \ | ||
63 | -T $(@D)/.tmp_$(@F:.o=.ver); \ | ||
64 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ | ||
65 | else \ | ||
66 | @@ -257,7 +257,7 @@ quiet_cmd_link_o_target = LD $@ | ||
67 | # If the list of objects to link is empty, just create an empty built-in.o | ||
68 | # -nostdlib is added to make "make LD=gcc ..." work (some people use that) | ||
69 | cmd_link_o_target = $(if $(strip $(obj-y)),\ | ||
70 | - $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ | ||
71 | + $(CC) $(ld_flags_partial) $(LDFLAGS_RELOCATABLE) -o $@ $(filter $(obj-y), $^),\ | ||
72 | rm -f $@; $(AR) rcs $@) | ||
73 | |||
74 | $(builtin-target): $(obj-y) FORCE | ||
75 | @@ -292,10 +292,10 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \ | ||
76 | $($(subst $(obj)/,,$(@:.o=-y)))), $^) | ||
77 | |||
78 | quiet_cmd_link_multi-y = LD $@ | ||
79 | -cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) | ||
80 | +cmd_link_multi-y = $(CC) $(ld_flags_partial) $(LDFLAGS_RELOCATABLE) -o $@ $(link_multi_deps) | ||
81 | |||
82 | quiet_cmd_link_multi-m = LD [M] $@ | ||
83 | -cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps) | ||
84 | +cmd_link_multi-m = $(CC) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps) | ||
85 | |||
86 | # We would rather have a list of rules like | ||
87 | # foo.o: $(foo-objs) | ||
88 | Index: busybox-1.23.2/scripts/Makefile.lib | ||
89 | =================================================================== | ||
90 | --- busybox-1.23.2.orig/scripts/Makefile.lib | ||
91 | +++ busybox-1.23.2/scripts/Makefile.lib | ||
92 | @@ -121,7 +121,8 @@ cpp_flags = -Wp,-MD,$(depfile) $(NO | ||
93 | # yet ld_flags is fed to ld. | ||
94 | #ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) | ||
95 | # Remove the -Wl, prefix from linker options normally passed through gcc | ||
96 | -ld_flags = $(filter-out -Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS)) | ||
97 | +ld_flags = $(filter-out -Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)) | ||
98 | +ld_flags_partial = $($(filter-out -shared%, $(filter-out -pie%,$(ld_flags)))) | ||
99 | |||
100 | |||
101 | # Finds the multi-part object the current object will be linked into | ||
102 | @@ -151,10 +152,8 @@ $(obj)/%:: $(src)/%_shipped | ||
103 | # Linking | ||
104 | # --------------------------------------------------------------------------- | ||
105 | |||
106 | -# TODO: LDFLAGS usually is supposed to contain gcc's flags, not ld's. | ||
107 | -# but here we feed them to ld! | ||
108 | -quiet_cmd_ld = LD $@ | ||
109 | -cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \ | ||
110 | +quiet_cmd_ld = CC $@ | ||
111 | +cmd_ld = $(CC) $(ld_flags) $(LDFLAGS_$(@F)) \ | ||
112 | $(filter-out FORCE,$^) -o $@ | ||
113 | |||
114 | # Objcopy | ||
diff --git a/meta/recipes-core/busybox/busybox/0002-Passthrough-r-to-linker.patch b/meta/recipes-core/busybox/busybox/0002-Passthrough-r-to-linker.patch new file mode 100644 index 0000000000..de286fb746 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0002-Passthrough-r-to-linker.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From df2cc76cdebc4773361477f3db203790f6986e3b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 22 Aug 2015 23:42:40 -0700 | ||
4 | Subject: [PATCH 2/2] Passthrough -r to linker | ||
5 | |||
6 | clang does not have -r switch and it does not pass it down to linker | ||
7 | either, LDFLAGS_RELOCATABLE is used when CC is used for LD, so this | ||
8 | should not cause side effects | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Makefile | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/Makefile b/Makefile | ||
18 | index 9da02cb..10dd4a9 100644 | ||
19 | --- a/Makefile | ||
20 | +++ b/Makefile | ||
21 | @@ -309,7 +309,7 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(C | ||
22 | MODFLAGS = -DMODULE | ||
23 | CFLAGS_MODULE = $(MODFLAGS) | ||
24 | AFLAGS_MODULE = $(MODFLAGS) | ||
25 | -LDFLAGS_RELOCATABLE = -r -nostdlib | ||
26 | +LDFLAGS_RELOCATABLE = -Xlinker -r -nostdlib | ||
27 | LDFLAGS_MODULE = $(LDFLAGS_RELOCATABLE) | ||
28 | CFLAGS_KERNEL = | ||
29 | AFLAGS_KERNEL = | ||
30 | -- | ||
31 | 2.1.4 | ||
32 | |||
diff --git a/meta/recipes-core/busybox/busybox_1.23.2.bb b/meta/recipes-core/busybox/busybox_1.23.2.bb index 5e027326c2..25598232ae 100644 --- a/meta/recipes-core/busybox/busybox_1.23.2.bb +++ b/meta/recipes-core/busybox/busybox_1.23.2.bb | |||
@@ -33,6 +33,8 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | |||
33 | file://0001-Switch-to-POSIX-utmpx-API.patch \ | 33 | file://0001-Switch-to-POSIX-utmpx-API.patch \ |
34 | file://0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch \ | 34 | file://0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch \ |
35 | file://0001-chown-fix-help-text.patch \ | 35 | file://0001-chown-fix-help-text.patch \ |
36 | file://0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch \ | ||
37 | file://0002-Passthrough-r-to-linker.patch \ | ||
36 | file://mount-via-label.cfg \ | 38 | file://mount-via-label.cfg \ |
37 | file://sha1sum.cfg \ | 39 | file://sha1sum.cfg \ |
38 | file://sha256sum.cfg \ | 40 | file://sha256sum.cfg \ |