diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.build | 11 | ||||
| -rwxr-xr-x | scripts/trylink | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5eac45f91..2a9f451f3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -254,11 +254,22 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; | |||
| 254 | # | 254 | # |
| 255 | ifdef builtin-target | 255 | ifdef builtin-target |
| 256 | quiet_cmd_link_o_target = LD $@ | 256 | quiet_cmd_link_o_target = LD $@ |
| 257 | ifeq ($(CONFIG_PLATFORM_POSIX),y) | ||
| 257 | # If the list of objects to link is empty, just create an empty built-in.o | 258 | # If the list of objects to link is empty, just create an empty built-in.o |
| 258 | # -nostdlib is added to make "make LD=gcc ..." work (some people use that) | 259 | # -nostdlib is added to make "make LD=gcc ..." work (some people use that) |
| 259 | cmd_link_o_target = $(if $(strip $(obj-y)),\ | 260 | cmd_link_o_target = $(if $(strip $(obj-y)),\ |
| 260 | $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ | 261 | $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ |
| 261 | rm -f $@; $(AR) rcs $@) | 262 | rm -f $@; $(AR) rcs $@) |
| 263 | else | ||
| 264 | # In default builds of busybox-w32 all builtin targets have either | ||
| 265 | # zero or one object files. In the latter case copy the object to | ||
| 266 | # the target. This avoids the need to use the linker: the llvm | ||
| 267 | # linker doesn't support the -r option. | ||
| 268 | cmd_link_o_target = $(intcmp $(words $(obj-y)),1,\ | ||
| 269 | rm -f $@; $(AR) rcs $@,\ | ||
| 270 | cp $(obj-y) $@,\ | ||
| 271 | $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^)) | ||
| 272 | endif | ||
| 262 | 273 | ||
| 263 | $(builtin-target): $(obj-y) FORCE | 274 | $(builtin-target): $(obj-y) FORCE |
| 264 | $(call if_changed,link_o_target) | 275 | $(call if_changed,link_o_target) |
diff --git a/scripts/trylink b/scripts/trylink index 2255deee7..776fd484a 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
| @@ -96,7 +96,7 @@ fi | |||
| 96 | START_GROUP="-Wl,--start-group" | 96 | START_GROUP="-Wl,--start-group" |
| 97 | END_GROUP="-Wl,--end-group" | 97 | END_GROUP="-Wl,--end-group" |
| 98 | INFO_OPTS() { | 98 | INFO_OPTS() { |
| 99 | echo "-Wl,--warn-common -Wl,-Map,$EXE.map -Wl,--verbose" | 99 | echo "$SORT_COMMON -Wl,-Map,$EXE.map -Wl,--verbose" |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | # gold may not support --sort-common (yet) | 102 | # gold may not support --sort-common (yet) |
