-
Notifications
You must be signed in to change notification settings - Fork 336
three fix of elf file creation #1312
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
Conversation
| if (rela->type == R_X86_64_32S && | ||
| is_text_section(relasec->base) && | ||
| !is_text_section(sym->sec) && | ||
| rela->type == R_X86_64_32S && |
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.
Please make this a separate commit.
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.
OK
| strncmp(rela->sym->name, ".rodata", 7)) { | ||
| ERROR("%s+0x%x: can't find replacement symbol for %s+%ld reference", | ||
| relasec->base->name, rela->offset, rela->sym->name, rela->addend); | ||
| } |
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.
If this error is getting removed, there needs to be more justification than "we think it is just ok".
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.
Also, why does .rela.orc_unwind_ip reference .orc_unwind_ip itself? That sounds like a different format compared to the x86 implementation, which only references text addresses.
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.
If this error is getting removed, there needs to be more justification than "we think it is just ok".
OK,Let's leave it not changed.
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.
Also, why does .rela.orc_unwind_ip reference .orc_unwind_ip itself? That sounds like a different format compared to the x86 implementation, which only references text addresses.
Yes,the rela format is a little different.
| continue; | ||
| list_for_each_entry_safe(rela, saferela, &sec->relas, list) | ||
| if (!rela->sym->sec->include) | ||
| if (!rela->sym->include || !rela->sym->sec->include) { |
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.
Hm, why haven't we seen this problem on x86?
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.
Yes, I checked the compiled c file fs/aio.c of x86_64.It reference to __dyndbg using the __dyndbg + offset,it did not use the symbols in the __dyndbg section ,so it has no problem.
But LoongArch generate relas using the symbols in __dyndbg(or __verbose in old version kernel) and triggers the problem.
I think we should avoid that condition even if there is no problem now for x86_64.
e_flags should be written to the output elf file,because it contain processor-specific flags. For example: LoongArch use e_flags to distinguish LP64/XLP32/LP32. Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
if one debug section's rela reference to __verbose section's symbol (for example, pr_debug) and some of __verbose section's symbols are included,then the __verbose section will be included. But other symbols of __verbose may be not included,then the debug section's relas reference to the not included symbols would result into bad rela in the end output elf file. So if the rela's symbol is not included,just delete that rela. Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
Let's do R_X86_64_32S judgment firstly, so other architectures would run a little faster. Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
ff698b7 to
bd7001a
Compare
|
Hi @jpoimboe create-diff-object: ERROR: static-local-moved-subfunction-issue-1054.ORIG.o: kpatch_replace_sections_syms: 1622: .orc_unwind_ip+0xc8: can't find replacement symbol for .init.text+711 reference: Success The reason seems to bee the offset 711 is outside of .init.text section. |
ff698b7 to
3c97552
Compare
found flag is set to false outside the whole loop of section symbol replacement. So if one replacement occur, later found check would always be ok which is not what we expected. So reset found to false before every section symbol replace. Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
3c97552 to
e4732c7
Compare
|
This PR has been open for 60 days with no activity and no assignee. It will be closed in 7 days unless a comment is added. |
|
This PR was closed because it was inactive for 7 days after being marked stale. |
Hi Josh,
We are preparing to support a new architecture:LoongArch . But we find some common problems of this tool,So I think we can submit the common patches firstly,Then the fllowing LoongArch support.
These three patches solve the following problem:
!strcmp(rela->sym->name, ".orc_unwind_ip"). IMO, too many compares in the code is not a good idea, so I clean the code and
make it easy to read.
don't follow it,then the rela would refer to an not included symbol which contains random data.
Thanks
Hongchen Zhang