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

Allow override of prefix-map build flag #3228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuyichao
Copy link
Contributor

By placing it before user supplied flags from the environment variables.

@yuyichao
Copy link
Contributor Author

I just realized that the prefix in the variable name and the variable value has nothing to do with each other.... Oh well, hopefully the comment at the variable initialization is clear enough...

@@ -69,18 +71,18 @@ configure_file(src/preload/rr_page.ld.in src/preload/rr_page.ld @ONLY)
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG("-fmacro-prefix-map=foo=bar" SUPPORTS_MACRO_PREFIX_MAP)
if (SUPPORTS_MACRO_PREFIX_MAP)
set(FLAGS_COMMON "${FLAGS_COMMON} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=")
set(PREFIX_FLAGS_COMMON "${PREFIX_FLAGS_COMMON} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this supposed to be used? In clang at least, fmacro-prefix-map is a hash table, with later entries overriding earlier ones. Doesn't that moot the usefulness of this option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "usefulness of this option"? The point is that distribution should be able to override this. Without any flags passed in, this should behave exactly the same without this PR and as useful as it was.

It does seem that clang and gcc handles this differently. For GCC, it seems that any later flags override earlier ones but for clang, later, less-specific ones does not override earlier flags. To allow distro override to work correctly, it seems that I would need to just disable this if a similar flag is passed in.

By placing it before user supplied flags from the environment variables.
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 this pull request may close these issues.

None yet

2 participants