-
Notifications
You must be signed in to change notification settings - Fork 770
[UR] Support conditional symbols in linker scripts #18629
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
base: sycl
Are you sure you want to change the base?
[UR] Support conditional symbols in linker scripts #18629
Conversation
The `get_loader_functions()` template helper now returns `list[dict]` instead of `list[str]`, this enables passing additional information into the loader script templates.
In order to pre-process files which don't support conditional inclusion of line blocks, such as linker scripts, we can use this script to remove lines which should not be included unless specified.
Actually use the `strip-guarded-lines.py` script when using `configure_file()` on linker scripts.
c81041b
to
466c42d
Compare
try: | ||
return True if re.match(cls.RE_POINTER, name) else False | ||
except: | ||
return bool(re.match(cls.RE_POINTER, name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would re.match(...) is not None
be more idiomatic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's certainly more typing. None
ness is equivalent to truthiness when uses in if
statements. My linter (pyright) doesn't warn about conversion to bool like this, it does warn about using re.match(cls.RE_POINTER, name) == None
instead of re.match(cls.RE_POINTER, name) is None
.
blocks of lines based on pre and post guard marker lines, a list of guard | ||
names to include in the output, and an input file. | ||
|
||
- Pre and post guard marker lines are always removed weather the are guards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence doesn't really make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
- Pre and post guard marker lines will always be removed even when those guard
names have not been specified for inclusion.
Combined the following changes enable adding guards around sections in linker script files which do not support conditional inclusion in their syntax. This is done by pre-processing the linker scripts as part of build configuration.
helper.py
and add typing hintsget_loader_functions()
template helper now returnslist[dict]
instead oflist[str]
, this enables passing additional information into the loader script templatesstrip-guarded-lines.py
strip-guarded-lines.py
script when usingconfigure_file()
on linker scripts