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

Make -fPIC optional. #23

Open
cemeceme opened this issue May 20, 2023 · 2 comments · May be fixed by #24
Open

Make -fPIC optional. #23

cemeceme opened this issue May 20, 2023 · 2 comments · May be fixed by #24

Comments

@cemeceme
Copy link

I am using please to handle the building of STM32 projects and most of the required flags and tools are possible to implement by defining them within a .plzconfig file.
However, it looks like please always adds the -fPIC flag to the compiler flags.
It is possible to override this by defining -fno-pic in the compiler_flags section of the c/cc build rules, however this is no longer a project-wide solution as defining all the flags in .plzconfig.

The code is being compiled by arm-none-eabi-g++ instead of the default tool and the inclusion of the -fPIC flag forces the definition of a global offset table in the STM provided linker scripts, as well as potentially adding some extra overhead that isn't necessary.

I realize embedded is not necessarily the goal of the cc-rules, but I have grown to really like please and would like to use it to build all my projects, including embedded code. It's certainly versatile enough to do so!

@Tatskaari
Copy link
Contributor

Tatskaari commented May 22, 2023

I think this makes a lot of sense. I wonder if @peterebden has any context as to why we add this flag here rather than just having it part of default flags config options? is it just that it's so commonly needed for general computers, and we didn't really consider embedded applications?

I wonder if we could address this in v2 of these rules while addressing some of the issues here: #9

@peterebden
Copy link
Collaborator

I honestly can't remember why -fPIC is injected that way. I wonder if it's something about ordering given the comment, but seems we should be able to achieve that anyway by adding to the default flags.

I guess it could technically be breaking if we move it from here to the defaults (because then you wouldn't get it if you overrode it in particular ways). On the bright side, we still haven't reached 1.0 yet so we're allowed to do that \o/

I wasn't specifically aiming at embedded with these, but there also shouldn't be anything that specific about them; I like the idea that they can be applied to that use case as well!

@Tatskaari Tatskaari linked a pull request May 22, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants