-
Notifications
You must be signed in to change notification settings - Fork 305
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
Add LoongArch support for kpatch #1424
Open
georgejguo
wants to merge
8
commits into
dynup:master
Choose a base branch
from
georgejguo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+106
−9
Conversation
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
Add section alt_instr check support for LoongArch. Signed-off-by: George Guo <[email protected]>
Add initial support for LoongArch. Signed-off-by: George Guo <[email protected]>
…ries Generate 2 NOPs right at the beginning of each function with -fpatchable-function-entry=2 in LoongArch. So here create section __patchable_function_entries and check this situation. Co-developed-by: zhanghongchen <[email protected]> Signed-off-by: George Guo <[email protected]>
Here fix error like: "tcp.o: symbol changed sections: .LBB7266. create-diff-object: unreconcilable difference". Due to LoongArch GCC generating local labels such as .LBB7266, it is difficult to compare the modified sections in the corresponding object files of the two files before and after the patch, so change them with sections symbols in rela section, and delete them in other sections. Co-developed-by: zhanghongchen <[email protected]> Signed-off-by: George Guo <[email protected]>
Take tcp.o as an example. An ld error occurs as follows: "ld: __patchable_function_entries has both ordered and unordered sections" when linking patch-hook.o and output.o. The link error is triggered by running the command: "ld -r --unique=.parainstructions --unique=.altinstructions -o patch/tmp_output.o output/net/ipv4/tcp.o". With -fpatchable-function-entry, LoongArch GCC sets WAL flags for section __patchable_function_entries in object file (which includes patch-hook.o) by default. Meanwhile, Kpatch sets A flags for output.o in create_section_pair(). To resolve the ld error, we set sh_flags = WAL. Signed-off-by: George Guo <[email protected]>
Since kpatch now supports LoongArch basically, enable the build. Signed-off-by: George Guo <[email protected]>
Omit patchable sections compare processing, as we will rebuild it. Signed-off-by: George Guo <[email protected]>
Added conditional compilation to prevent 'R_LARCH_64' and 'EM_LOONGARCH' from being referenced on x86 and other non-LoongArch architectures. This ensures the code works across different architectures without errors. Signed-off-by: George Guo <[email protected]>
Thanks for opening the PR, @georgejguo . The plan is to first merge PR #1415 as the patchable_function_entries section support is not limited to a single arch. Once that code is in place, the arm64 support PR shrinks drastically. I would think a similar simplification for loongarch would be true as well. |
Okey, I have seen PR #1415, I'm waiting for it to be merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.