Page MenuHomeFreeBSD

lib/csu: add LoongArch support
Needs ReviewPublic

Authored by zhaoxiaoqiang007_gmail.com on Tue, Sep 22, 2:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 9, 3:39 AM
Unknown Object (File)
Thu, Oct 8, 9:48 AM
Unknown Object (File)
Tue, Oct 6, 6:37 PM
Unknown Object (File)
Tue, Oct 6, 1:42 PM
Unknown Object (File)
Sun, Oct 4, 3:49 AM
Unknown Object (File)
Fri, Oct 2, 9:40 PM
Unknown Object (File)
Fri, Oct 2, 7:43 AM
Unknown Object (File)
Thu, Oct 1, 10:47 PM

Details

Reviewers
kib
imp
dchagin
Summary

crt1/crti/crtn and self-relocation 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 77172
Build 74055: arc lint + arc unit

Event Timeline

A few high-level comments.

These files contain $FreeBSD$ which should is long obsolete and should never be present.

As with @imp's comments on D59893, the bringing over the copyrights and acknowledgements is questionable.

Please don't implement crti and crtn. The _init and _fini functions are obsolete and should not be supported in new architectures. IMO it was an error to have added support to RISC-V.

A few high-level comments.

These files contain $FreeBSD$ which should is long obsolete and should never be present.

As with @imp's comments on D59893, the bringing over the copyrights and acknowledgements is questionable.

Please don't implement crti and crtn. The _init and _fini functions are obsolete and should not be supported in new architectures. IMO it was an error to have added support to RISC-V.

ok

shipujin.t_gmail.com added inline comments.
lib/csu/loongarch/crtn.S
2

__FBSDID("$Free$") is the old style and is suggested to be removed.

15

This works functionally, but for consistency with the code style of the other architectures, it is suggested to change it to:

ret
17

This looks like an FPU ABI flag copied from MIPS, and LoongArch does not need it.

Suggested change to:

.section .fini,"ax",@progbits
lib/csu/loongarch/crt1_s.S
49–50

It can be changed more concisely:

bl		__start
lib/csu/loongarch/crt1_s.S
49–50

yes

lib/csu/loongarch/crtn.S
2

understand

15

looks better

17

thx

Please don't implement crti and crtn. The _init and _fini functions are obsolete and should not be supported in new architectures. IMO it was an error to have added support to RISC-V.

Is it appropriate to change the clang FreeBSD driver to reflect this ?
I have opened a PR for this: https://github.com/llvm/llvm-project/pull/228689

More copyright tagging advice.

lib/csu/loongarch/Makefile
1

this line, and the following blank link, need to go.

lib/csu/loongarch/crt.h
2

This should have a new copyright, as described elsewhere. This will also solve the stray $FreeBSD$ issue too.

lib/csu/loongarch/crt1_s.S
3

This is a whole new file, so should have the new, short-form copyright

lib/csu/loongarch/crti.S
1

This file needs a copyright.

2

this needs to be deleted.

lib/csu/loongarch/crtn.S
1

This file needs a copyright.

lib/libc/csu/loongarch/Makefile.inc
1

I'd be tempted to delete the first two lines.

lib/libc/csu/loongarch/reloc.c
2

This is effectively a whole new file, so needs a copy short-form copyright.