Page MenuHomeFreeBSD

rtld: add LoongArch support
Needs ReviewPublic

Authored by zhaoxiaoqiang007_gmail.com on Tue, Sep 22, 2:25 PM.
Tags
None
Referenced Files
F176530222: D59897.id187415.diff
Mon, Oct 19, 2:37 PM
Unknown Object (File)
Fri, Oct 16, 10:31 AM
Unknown Object (File)
Wed, Oct 14, 1:34 AM
Unknown Object (File)
Mon, Oct 12, 9:52 PM
Unknown Object (File)
Mon, Oct 12, 9:26 PM
Unknown Object (File)
Fri, Oct 9, 2:59 AM
Unknown Object (File)
Wed, Oct 7, 11:15 AM
Unknown Object (File)
Tue, Oct 6, 8:44 PM

Details

Summary

Add rtld_start.S, the relocation handler and MD glue for LoongArch.

Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007@gmail.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77177
Build 74060: arc lint + arc unit

Event Timeline

libexec/rtld-elf/loongarch/reloc.c
2

Did Ruslan wrote this file?

libexec/rtld-elf/loongarch/reloc.c
2

The code is all copied from riscv for the entire patch series, so interesting copyright appears throughout. Files that have been materially edited should have an appropriate copyright from LoongArch authors though to document that it was not in fact (solely) written by the same people as riscv (which in turn has its own chains of history...).

libexec/rtld-elf/loongarch/reloc.c
443

Maybe we need an __unused here to make it compile.

libexec/rtld-elf/loongarch/reloc.c
2

The code is all copied from riscv for the entire patch series, so interesting copyright appears throughout. Files that have been materially edited should have an appropriate copyright from LoongArch authors though to document that it was not in fact (solely) written by the same people as riscv (which in turn has its own chains of history...).

update in next reversion.

443

Yes!

shipujin.t_gmail.com added inline comments.
libexec/rtld-elf/loongarch/reloc.c
197

parameters defined for call_ifunc_resolver in libexec/rtld-elf/loongarch/rtld_machdep.h are inconsistent with how it is used here.

libexec/rtld-elf/loongarch/rtld_machdep.h
50

set_gp function is only declared, but never defined or used.

67–71

There is a redundant semicolon at the end of the macro.

libexec/rtld-elf/loongarch/rtld_start.S
51–52

Using la.local + jirl to call _rtld is less concise than bl.

Suggested change to:

	bl	_rtld		/* Call the loader */
67

Corresponding changes:

Save the arguments and ra
78–87

According to the LoongArch ELF ABI - Register Convention, which states that "Static registers are also known as callee-saved registers" and that $s0–$s9 should be preserved by the callee, _rtld_bind() as a C function will save these registers itself. _rtld_bind_start does not need to save $fp/$s0–$s8, so please remove them and adjust the stack frame.

103

Corresponding changes:

Save the arguments and ra
113–122

According to the LoongArch ELF ABI - Register Convention, which states that "Static registers are also known as callee-saved registers" and that $s0–$s9 should be preserved by the callee, _rtld_bind() as a C function will save these registers itself. _rtld_bind_start does not need to save $fp/$s0–$s8, so please remove them and adjust the stack frame.