Digging deeper:
The rule that builds executables is defined in: build/core/definitions.mk in the transform-host-o-to-executable-inner variable
This is how it looks like
ifneq ($(HOST_CUSTOM_LD_COMMAND),true) define transform-host-o-to-executable-inner $(hide) $(PRIVATE_CXX) \ -Wl,-rpath-link=$(HOST_OUT_INTERMEDIATE_LIBRARIES) \ -Wl,-rpath,\$$ORIGIN/../lib \ $(HOST_GLOBAL_LD_DIRS) \ $(PRIVATE_LDFLAGS) \ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \ $(HOST_GLOBAL_LDFLAGS) \ ) \ $(PRIVATE_ALL_OBJECTS) \ -Wl,--whole-archive \ $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ -Wl,--no-whole-archive \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \ $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \ $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ -o $@ \ $(PRIVATE_LDLIBS) endef endif
Based on that I simply thing that instead of saying
LOCAL_LDFLAGS = ...
the test should simply state
LOCAL_LDLIBS = ...
Digging deeper:
The rule that builds executables is defined in: build/core/ definitions. mk in the transform- host-o- to-executable- inner variable
This is how it looks like
ifneq ($(HOST_ CUSTOM_ LD_COMMAND) ,true) host-o- to-executable- inner -rpath- link=$( HOST_OUT_ INTERMEDIATE_ LIBRARIES) \ -rpath, \$$ORIGIN/ ../lib \ GLOBAL_ LD_DIRS) \ LDFLAGS) \ NO_DEFAULT_ COMPILER_ FLAGS), , \
$(HOST_ GLOBAL_ LDFLAGS) \ ALL_OBJECTS) \ --whole- archive \ host-libraries, $(PRIVATE_ ALL_WHOLE_ STATIC_ LIBRARIES) ) \ --no-whole- archive \ GROUP_STATIC_ LIBRARIES) ,-Wl$(comma) --start- group) \ host-libraries, $(PRIVATE_ ALL_STATIC_ LIBRARIES) ) \ GROUP_STATIC_ LIBRARIES) ,-Wl$(comma) --end-group) \ host-libraries, $(PRIVATE_ ALL_SHARED_ LIBRARIES) ) \ LDLIBS)
define transform-
$(hide) $(PRIVATE_CXX) \
-Wl,
-Wl,
$(HOST_
$(PRIVATE_
$(if $(PRIVATE_
) \
$(PRIVATE_
-Wl,
$(call normalize-
-Wl,
$(if $(PRIVATE_
$(call normalize-
$(if $(PRIVATE_
$(call normalize-
-o $@ \
$(PRIVATE_
endef
endif
Based on that I simply thing that instead of saying
LOCAL_LDFLAGS = ...
the test should simply state
LOCAL_LDLIBS = ...