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

File specific compiler options #24

Closed
NicoHood opened this issue Aug 24, 2017 · 0 comments
Closed

File specific compiler options #24

NicoHood opened this issue Aug 24, 2017 · 0 comments

Comments

@NicoHood
Copy link
Contributor

NicoHood commented Aug 24, 2017

Regarding #21 I generally want to enable LTO. However some files need to be compiled without LTO (you can use -fno-lto). However this is impossible with dmbs it seems. Do you know how to change/add compilation flags for single files? The only solution I can think of is to create multiple makefiles, which is a really bad idea, I already tried that.

Maybe a special target can be written for that file that can add additonal flags?

More details for my particular issue:
I got an inline asm function _micros Which I want to call with an inline asm call _micros. However the symbol name changes to this, when LTO is used. So I need to disabled LTO for this file. I did not found any other way. The number is also random:

00000000 l    d  .gnu.lto__micros.3cfd9897f8dbd587	00000000 .gnu.lto__micros.3cfd9897f8dbd587

Solution

gcc.mk (same for .c/.S files)

# Compiles an input C++ source file and generates a linkable object file for it
$(OBJDIR)/%.o: %.cpp $(MAKEFILE_LIST)
	@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$(notdir $<)\"
	$(CROSS)-g++ -c $(BASE_CC_FLAGS) $(BASE_CPP_FLAGS) $(CC_FLAGS) $(CPP_FLAGS) $($(notdir $<)_FLAGS) -MMD -MP -MF $(@:%.o=%.d) $< -o $@

Makefile:

FastLED_compat.c_FLAGS = -fno-lto

Since every file must be unique #12 this should not be a problem if we do it like that.

NicoHood added a commit to NicoHood/dmbs that referenced this issue Aug 25, 2017
NicoHood added a commit to NicoHood/dmbs that referenced this issue Oct 2, 2017
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