MSVC link.exe implements the /section flag for modification of section attributes.
Before, lld-link only supported rudimentary usage of said flag, which prevented
fine-grained control such as disabling attributes and overriding access.
Now, it is compatible with MSVC link.exe, including undocumented but relied upon behaviors.
Details
- Reviewers
ruiu
Diff Detail
Event Timeline
lld/COFF/Config.h | ||
---|---|---|
88 | I feel enabled/disabled are better names than enable/disable. access is not actually a mask but a value itself, so AttributeMask might be little bit confusing. How about this? Rename this struct SectionAttributes, and rename members enabledFlags, disabledFlags and accessBits. nit: separate members by ; instead of ,. | |
lld/COFF/DriverUtils.cpp | ||
172 | I'd copy values instead of taking pointers, and assign back to mask.enable and mask.disable at the end of this function, so that we can eliminate *s. |
lld/COFF/Config.h | ||
---|---|---|
88 | You're right, I'll rename the struct. | |
lld/COFF/DriverUtils.cpp | ||
172 | The pointers are the most elegant I could find since they allow to both set the correct field & preserve the information of whether we're currently enabling or disabling flags. |
Fixed review comments, mainly renames,
Also, fixed parseSectionAttributes (previously parseSectionAttributeMask) returning an unused value.
After second thought, also decided to change said function to avoid using pointers.
I feel enabled/disabled are better names than enable/disable.
access is not actually a mask but a value itself, so AttributeMask might be little bit confusing.
How about this? Rename this struct SectionAttributes, and rename members enabledFlags, disabledFlags and accessBits.
nit: separate members by ; instead of ,.