Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在不修改bl_iot_sdk内代码的情况下,如何修改gcc编译器选项? #85

Open
FlyyingPiggy2020 opened this issue Oct 26, 2024 · 1 comment

Comments

@FlyyingPiggy2020
Copy link

image

	-Wl,--whole-archive \
	$(COMPONENT_LDFLAGS) \
	-Wl,--no-whole-archive \

我想增加如下的编译选项,除了直接在bl_iot_sdk内修改外,请问有办法改LDFLAGS吗?

@FlyyingPiggy2020
Copy link
Author

把makefile看完了。。
需要在对应组件下的bouffalo.mk文件中添加 COMPONENT_ADD_LDFLAGS_HEAD COMPONENT_ADD_LDFLAGS_TAIL

COMPONENT_ADD_LDFLAGS_HEAD += -Wl,--whole-archive
COMPONENT_ADD_LDFLAGS_TAIL += -Wl,--no-whole-archive

这两个选项在构建component_project_vars.mk时候会放到 COMPONENT_LDFLAGS 两端:
(看COMPONENT_LDFLAGS 那一行)

component_project_vars.mk::
	$(details) "Building component project variables list $(abspath $@)"
	@echo '# Automatically generated build file. Do not edit.' > $@
	@echo 'COMPONENT_INCLUDES += $(call lib_MakeVariablePath,$(abspath $(addprefix $(COMPONENT_PATH)/,$(COMPONENT_ADD_INCLUDEDIRS))))' >> $@
	@echo 'COMPONENT_LDFLAGS += $(COMPONENT_ADD_LDFLAGS_HEAD) $(call lib_MakeVariablePath, $(COMPONENT_ADD_LDFLAGS)) $(COMPONENT_ADD_LDFLAGS_TAIL)' >> $@
	@echo 'COMPONENT_LINKER_DEPS += $(call lib_MakeVariablePath,$(call resolvepath,$(COMPONENT_ADD_LINKER_DEPS),$(COMPONENT_PATH)))' >> $@
	@echo 'component-$(COMPONENT_NAME)-build: $(addprefix component-,$(addsuffix -build,$(COMPONENT_DEPENDS)))' >> $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant