Commit graph

10807 commits

Author SHA1 Message Date
Yu Liu
86ef94783b Merge "Refactor the bp file to avoid arch variant in cc_genrule." 2022-10-18 02:19:03 +00:00
Yu Liu
ed2654cfdc Refactor the bp file to avoid arch variant in cc_genrule.
The arch variant of genrule.out will be soon disallowed in soong.

Bug: 253645813
Test: Manually build.
Change-Id: Ia07d45195de8c22f18487aef34795279d2962c4c
2022-10-17 16:36:30 -07:00
Elliott Hughes
7a19624698 Add riscv64 crtbegin assembler.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: I712a9a93a2df208d763bc46175e00ff763b68146
2022-10-17 21:06:19 +00:00
Elliott Hughes
604ab0fe82 riscv64: enable the version scripts.
Test: treehugger
Change-Id: Idd7b3610bd3321d7e1a4e868cf5dbaf2980909ab
2022-10-17 21:06:10 +00:00
Elliott Hughes
6cef594171 Merge "riscv64: add bionic assembler and string functions." 2022-10-15 15:40:49 +00:00
Elliott Hughes
ebc19a9ccb riscv64: add bionic assembler and string functions.
Pull the portable C string functions from FreeBSD, and do fairly literal
translations of our existing .S files for the bionic-specific stuff.

Test: treehugger
Change-Id: Id42e5b8a51ed73155be020d74edd7011a2103574
2022-10-14 23:25:36 +00:00
Elliott Hughes
faac8e658c arm64: remove unnecessary duplication of constants in vfork.S.
Test: treehugger
Change-Id: I41fd22bad0581269c88f5b3bb499735ab6ecafd2
2022-10-14 21:36:58 +00:00
Elliott Hughes
4c2de1fccc Merge "riscv64 syscall stub and seccomp filter generation." 2022-10-14 14:36:29 +00:00
Elliott Hughes
704772bda0 riscv64 syscall stub and seccomp filter generation.
These are sufficiently intertwined that they need to be done together.
riscv64 is our first primary-only architecture, so that required some
changes. The .bp changes are to support this --- we need to only show
the python scripts the architectures they'll actually be using, rather
than showing them everything and ignoring some of the results.

riscv64 is also the first architecture that post-dates the kernel's
64-bit time work, so there's a bit of extra fiddling needed to handle
the __NR3264_ indirection in the uapi headers.

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: local builds for x86-64 and riscv64
Change-Id: I74044744e80b312088f805c44fbd667c9bfcdc69
2022-10-13 23:41:53 +00:00
Colin Cross
91529b75cf Add REG_S0 to ucontext.h for riscv64
REG_S0 is needed by Clang's sanitizer runtimes:
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp#L2218

Test: clang build
Change-Id: Id9a82e977dcbdddf5505495b59057cf4564c9e35
2022-10-13 13:27:18 -07:00
Elliott Hughes
c5e588ad37 Merge "riscv64 TLS support." 2022-10-12 00:35:37 +00:00
Treehugger Robot
6987120b30 Merge "riscv64: add "private/bionic_asm.h"." 2022-10-11 02:33:11 +00:00
Treehugger Robot
d5b5adfa87 Merge "riscv64: more <sys/ucontext.h>." 2022-10-11 02:15:10 +00:00
Jingwen Chen
7f50756d59 Merge "Use allowlists.go for all bp2build config and remove Android.bp prop." 2022-10-11 00:36:44 +00:00
Elliott Hughes
add0c48a4b riscv64: add "private/bionic_asm.h".
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Iaa7d5584dfd0ec6f0cf6d3d43ae6bdf2261b12f8
2022-10-11 00:04:34 +00:00
Elliott Hughes
287f48e6e5 riscv64: more <sys/ucontext.h>.
Actually, we don't want to reuse the kernel struct ucontext because its
uc_mcontext has the wrong type, which means the fields within that end
up with the wrong names. Add the call site that made that evident, and
update <sys/ucontext.h> appropriately.

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: If1d079afef0d5953aa22d9b0e049cfb0119c7718
2022-10-11 00:01:35 +00:00
Elliott Hughes
43462707a1 riscv64 TLS support.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: I14efb4a03a3dc2ec736d7e47a3f8859c886eb9d6
2022-10-10 20:30:24 +00:00
Elliott Hughes
4043e5ea96 Add riscv64 <ucontext.h>.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Ieb7cb71cd735b6629d507efb0a5e35ee653e4d20
2022-10-10 20:15:51 +00:00
Elliott Hughes
5b2552a030 Merge "riscv64 <sys/user.h>." 2022-10-10 16:36:10 +00:00
Jingwen Chen
95ca177c58 Use allowlists.go for all bp2build config and remove Android.bp prop.
This was introduced when we didn't have allowlists.

Bug: 251197532
Test: presubmits
Change-Id: I83713dd9a0a059acda8e4565677d0c8c6b966749
2022-10-10 14:35:15 +00:00
Elliott Hughes
c6bddf4516 Merge "riscv64 <fenv.h>." 2022-10-08 03:03:13 +00:00
Elliott Hughes
e0b9474854 Merge "riscv64 __get_tls()." 2022-10-08 03:02:56 +00:00
Treehugger Robot
002b57c00e Merge "riscv64 BIONIC_STOP_UNWIND." 2022-10-07 23:15:25 +00:00
Elliott Hughes
fc009dd8a7 riscv64 __get_tls().
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Ie7616cef6d394ba457c30c58d15f696c9b6d3853
2022-10-07 21:33:57 +00:00
Elliott Hughes
203b0b7346 riscv64 BIONIC_STOP_UNWIND.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: I1b6723e9fb60de8f98a716ef388ec81a41df02d3
2022-10-07 21:33:08 +00:00
Elliott Hughes
4c6d66c472 riscv64 <fenv.h>.
Just the interface for now; implementation to come later.

Test: treehugger
Change-Id: Id1f0b158f708ff501b5e13fe92c6736e4507d7b6
2022-10-07 21:15:26 +00:00
Elliott Hughes
cf123811b7 riscv64 <sys/user.h>.
Empty, at least for now. The other libcs seem not to have invented types
here, so let's see whether there's really a call for them before we do.

Test: treehugger
Change-Id: Icbace2c02abc011388edc8e3e238bb64c640feb7
2022-10-07 20:49:07 +00:00
Elliott Hughes
48e5333dd0 Pull in the riscv64 uapi headers for riscv64 builds.
Test: treehugger
Change-Id: I0c41a1a5b9805057609c68a49f67e6e24d4a0572
2022-10-07 20:39:25 +00:00
Elliott Hughes
0f19b10b5d Switch to FreeBSD's elf_common.h.
In particular, it contains all the riscv64 definitions we need, and lets
us clear up a lot of our existing ELF headers.

The other two BSDs seem to have errors and/or gaps in their riscv64
constants.

Test: treehugger
Change-Id: I92e48ef56c52c271ff6ed341b82169aa91f11d98
2022-10-07 00:04:44 +00:00
Elliott Hughes
bba6ddff12 Kernel header scrubber: remove unused map entries.
I was going to add riscv64 and define __riscv_xlen to 64 here, but our
"preprocessor" in python can't simpify `MACRO_NAME == 123` expressions
anyway. Rather than add another empty map, remove the other unused maps
and explain why this functionality is still useful as long as the legacy
32-bit ABIs are still with us.

Test: treehugger
Change-Id: I553059942920e7d323a0ca8a6fd5f39bc2d35063
2022-10-06 20:40:44 +00:00
Elliott Hughes
76be72dde4 Add __tls_get_addr for riscv64.
We added this symbol somewhat inconsistently, with arm and x86-64 in one
release and arm64 in another. It doesn't really matter where we add
riscv64 (since there was no riscv64 at either of these now-historical
API levels), so arbitrarily go with the majority.

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: I1ef1e0ebdbece728aaef52c08ee57cca1197cb95
2022-10-06 15:18:35 +00:00
Elliott Hughes
5394de7b05 Merge "riscv64's struct stat is the same as arm64's." 2022-10-06 14:41:03 +00:00
Elliott Hughes
5cc8a46419 riscv64's struct stat is the same as arm64's.
(And all other new architectures.)

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Iceb2dd16c738302624980179788c4a2e68b797ed
2022-10-06 00:26:18 +00:00
Elliott Hughes
82770d8bfe Merge "Call out the REL architectures and make RELA the default." 2022-10-05 21:42:04 +00:00
Elliott Hughes
6cfd1b59b0 Call out the REL architectures and make RELA the default.
That is: list the two legacy architectures rather than non-legacy ones!

Test: treehugger
Change-Id: I6545a27e740d83e0279b04f161cec179bb0253af
2022-10-05 21:41:48 +00:00
Treehugger Robot
5f16769da6 Merge "Add riscv64 to the map files." 2022-10-05 19:39:34 +00:00
Treehugger Robot
60bf36be00 Merge "Tell the version script generation script about risc-v." 2022-10-05 19:30:05 +00:00
Elliott Hughes
de1df210bb Remove a mips-specific hack.
Rather than add risc-v to this map, let's just remove the map!

Test: treehugger
Change-Id: I118c74c61af95a96f8e31ae6e422619ed86c6a3b
2022-10-05 00:05:05 +00:00
Elliott Hughes
df48d0f902 Add riscv64 to the map files.
The alternative would be to define an "lp64" shorthand like we have for
SYSCALLS.TXT, but since this functionality is only used by bionic and
old frameworks code to document historical oddities, it's unclear that
it's worth implementing. We shouldn't ever need architecture-specific
annotations again in future.

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Id64b1746e7490b2d7ad3e4627e9908c28f8f23ba
2022-10-04 23:52:57 +00:00
Elliott Hughes
0a3442526b Tell the version script generation script about risc-v.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: If2c35381159433a6337f4d892ef5689236d0a739
2022-10-04 22:48:38 +00:00
Treehugger Robot
9ba92331dd Merge "Remove unused variable." 2022-10-04 22:08:36 +00:00
Elliott Hughes
dc810a3c13 Remove unused variable.
Looks like we're not using this any more, so rather than add risc-v,
let's just remove this list.

Test: treehugger
Change-Id: I24bb22235c55d48c7dcbae94514ce8dcd03521c3
2022-10-04 20:21:20 +00:00
Elliott Hughes
6660d6c00b Rewrite renameat().
risc-v doesn't have renameat(2), only renameat2(2). Similar to other
architectures, let's make sure everyone's on the same code path by
having all implementations of renameat() go via renameat2().

I've also moved the existing rename()-in-terms-of-renameat() to be in
terms of renameat2() to cut out the middleman!

Test: treehugger
Change-Id: Ibe5e69aca5b39ea014001540bcd4fd3003e665cb
2022-10-04 20:13:49 +00:00
Treehugger Robot
4d974e29d5 Merge "Clarify the docs for updating kernel headers." 2022-10-03 18:00:52 +00:00
Elliott Hughes
93fb6b9459 Clarify the docs for updating kernel headers.
When I followed these instructions for risc-v, I mistakenly thought
that the auto-download option was a convenience that would get the
currently-approved headers, not the absolute latest. Make it clearer in
the documentation that this is for experts only, not for production.

Test: N/A
Change-Id: Iedce8ca0403b83e13bbe339cf343f85a37e99334
2022-10-01 15:29:37 +00:00
Elliott Hughes
5e7f8f116d Initial import of the risc-v uapi headers.
From external/kernel-headers.

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Id73a86c9df77825853004137f8b801b24bba93f9
2022-10-01 15:10:58 +00:00
Elliott Hughes
05ef5d46c9 Add riscv64 to the list of uapi architectures.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: bionic/libc/kernel/tools/generate_uapi_headers.sh
Change-Id: I926e1ceaab78b1bb9ae00cf39eb14005aae38e48
2022-09-30 21:37:57 +00:00
Elliott Hughes
ee41a35cc1 Extend the process_madvise() docs.
In particular, explain why we don't have process_mremove(), and why
adding this was probably a mistake (lest it be used as precedent for
similar bad decisions in future).

Also add the missing __INTRODUCED_IN().

Test: treehugger
Change-Id: Ic2d7ef32f6e288353b5be2bffd000ad2f501bf39
2022-09-27 19:27:10 +00:00
Elliott Hughes
305399264b Merge "Add __freadahead." 2022-09-27 18:47:34 +00:00
Benjamin Lerman
27a37e70a7 fdsan: fix overflow in FdTableImpl::at
Change-Id: Ia687eb52a9c5469225550316f884c229a2218724
2022-09-27 11:39:04 +02:00