forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elfnote: convert most usages of ELFNOTE_START() to ELFNOTE()
These usages can be converted into one-liners. Signed-off-by: Ilie Halip <[email protected]>
- Loading branch information
Showing
9 changed files
with
9 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c58ec05
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.
So whenever I see lots of repetition, like
ELFNOTE(Linux, 0, .long LINUX_VERSION_CODE)
I think "don't repeat yourself" (aka DRY principle).We could convert all these to also implicitly pass
Linux, 0, .long LINUX_VERSION_CODE
, just like you did for the previous patch in this series.It looks like just arch/x86/entry/vdso/vdso32/note.S sets
ELFNOTE_START(GNU, 2, "a")
. Maybe you can dig into the context of that change and see if it's still necessary; if it's not, than removing that first would allow for more aggressive and DRY'er refactoring.c58ec05
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.
GNU libc supports pseudo-hwcaps which is loads from the vDSO's type 2 GNU note. The process is documented a bit in https://sourceware.org/git/?p=glibc.git;a=commit;h=141af660d825d4443cbc5c24d29d57d6f8b0950f.
Looks like this feature is still used by Xen to load some optimized libraries, though at least Red Hat removed it for 32-bit Xen in RHEL8.
c58ec05
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.
Great sleuthing. In that case, why don't we split the macro in two, or create a new that we will use more often?
Then you can just use
ELFNOTE_LINUX
everywhere, and the lone type 2 GNU note doesn't have to change. That way the common case is more concise.Thoughts?
c58ec05
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.
I would avoid including
version.h
directly inelfnote.h
for just a macro like that. What about something like this instead?And its usage would be like this: