Page MenuHomeFreeBSD

build: add LoongArch build infrastructure
Needs ReviewPublic

Authored by zhaoxiaoqiang007_gmail.com on Tue, Sep 22, 2:23 PM.
Tags
None
Referenced Files
F175530966: D59891.id187408.diff
Sun, Oct 11, 12:31 PM
Unknown Object (File)
Thu, Oct 8, 1:44 AM
Unknown Object (File)
Wed, Oct 7, 8:01 PM
Unknown Object (File)
Tue, Oct 6, 11:21 PM
Unknown Object (File)
Tue, Oct 6, 9:46 PM
Unknown Object (File)
Tue, Oct 6, 9:44 PM
Unknown Object (File)
Tue, Oct 6, 5:28 PM
Unknown Object (File)
Tue, Oct 6, 4:18 PM

Details

Reviewers
markj
jhb
olce
Summary

Add sys/conf/{Makefile,files,ldscript,options}.loongarch and wire
loongarch into the top-level Makefiles, bsd.*.mk and the module
build so world and kernels can be built for the architecture.
See the LoongArch kernel commit for architecture references.

Signed-off-by: Xiaoqiang Zhao <zhaoxiaoqiang007@gmail.com>

Diff Detail

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

Event Timeline

shipujin.t_gmail.com added inline comments.
sys/conf/ldscript.loongarch
73

The missing .init_array/.fini_array is an inconsistency with upstream and may cause constructors not to be executed.
However, modern compilers (GCC/Clang) place generated constructors in .init_array (and .fini_array) by default, not .ctors. If the linker script does not explicitly handle these two sections, they will become orphan sections, which may be discarded or placed in the wrong location, causing global constructors not to be executed.
Add:

.init_array    :   
{
  PROVIDE_HIDDEN (__init_array_start = .); 
  KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
  KEEP (*(.init_array))
  PROVIDE_HIDDEN (__init_array_end = .); 
}
.fini_array    :   
{
  PROVIDE_HIDDEN (__fini_array_start = .); 
  KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
  KEEP (*(.fini_array))
  PROVIDE_HIDDEN (__fini_array_end = .); 
}
92โ€“96

__global_pointer$ is defined here, but it is not referenced anywhere in the LoongArch startup code (locore.S) or under sys/loongarch/, so this definition is currently "dangling" and it is suggested to remove it.

sys/conf/ldscript.loongarch
73

much thanks!

92โ€“96

right

share/mk/bsd.cpu.mk
22

should stay in alpha order, so just after i386

share/mk/bsd.endian.mk
9

in alpha order, after i386

share/mk/bsd.cpu.mk
22

Yes, will fix that later

sys/modules/Makefile
672

This list is kinda long, and maybe needs to be the list of things that cxgbe works on.