Commit graph

39147 commits

Author SHA1 Message Date
Juan Yescas
4c562594d9 Merge changes from topic "bionic_max_pgsize" into main
* changes:
  bionic: libc: WriteProtected use max_page_size()
  bionic: Introduce max_page_size()
2023-08-20 17:05:07 +00:00
Treehugger Robot
0c56cbad11 Merge "Add some new risc-v ELF relocations." into main 2023-08-20 08:20:14 +00:00
Kalesh Singh
2bdf22e992 bionic: libc: WriteProtected use max_page_size()
In the 4k targets there is no fucntional difference since
max_page_size() == page_size() == 4096.

On a 16kb device max_page_size() == 65536 and page_size() == 16384.
However, aligning up does not incur any memory regressions
since the .bss section is still be backes in page-sizeed chunks.

See: go/16k-page-aligned-variables

Bug: 296275298
Test: mma
Change-Id: I41c3e410f3b84c24eeb969c9aeca4b33a8d6170a
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-19 00:05:12 +00:00
Kalesh Singh
307bae7afe bionic: Introduce max_page_size()
This can be used to "page-align" variables at build time -
__attribute__((aligned(max_pge_size()))), so it is a
preprocessor macro instead of an inline function.

There is no functional change to the 4kB-only build targets
(!defined(__BIONIC_NO_PAGE_SIZE_MACRO))

Bug: 296275298
Test: mma
Change-Id: I462e9f971a176b6b59e32e449a2e11f95c3f1b45
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-19 00:04:53 +00:00
Elliott Hughes
f517b68c82 Add some new risc-v ELF relocations.
Also add the link to the canonical source.

Test: treehugger
Change-Id: I06c5d1ded5e1b372630c6963c81947450946c29a
2023-08-18 17:51:53 +00:00
Elliott Hughes
c983dbf0b2 Merge "Point to the riscv64 psABI frame pointer documentation." into main 2023-08-16 14:36:42 +00:00
Elliott Hughes
f9571ec851 Point to the riscv64 psABI frame pointer documentation.
Test: N/A
Change-Id: I6639ecfe75a4f0e3caaf7347676997e0e214f6c8
2023-08-14 19:19:39 +00:00
Juan Yescas
6e73f92f04 Merge changes from topic "bionic no page size macro" into main
* changes:
  bionic: PAGE_SIZE macro won't be used in page size agnostic targets
  bionic: Use getauxval(AT_PAGESZ) for page agnostic targets
2023-08-11 05:45:07 +00:00
Juan Yescas
7de2012422 bionic: PAGE_SIZE macro won't be used in page size agnostic targets
When the C flag -D__BIONIC_NO_PAGE_SIZE_MACRO is defined,
the PAGE_SIZE macro won't be used for page size agnostic builds.

Note: Only arm64 architectures support page size agnostic builds.

Bug: 277272383
Bug: 289419664

Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m

      source build/envsetup.sh
      lunch aosp_cf_x86_64_phone
      m

Change-Id: I755d5fcdd493fe6da5277a60d8e90805e9b2754d
2023-08-10 15:33:02 -07:00
Juan Yescas
49fdb0babf bionic: Use getauxval(AT_PAGESZ) for page agnostic targets
When the C flag -D__BIONIC_NO_PAGE_SIZE_MACRO is defined,
the function getauxval(AT_PAGESZ) will be called instead of
using the PAGE_SIZE macro for the arm64 architectures.

Bug: 277272383
Bug: 289419664

Test: source build/envsetup.sh
      lunch aosp_raven_pgagnostic_64-userdebug
      m

      source build/envsetup.sh
      lunch aosp_cf_x86_64_phone
      m

Change-Id: Ie904ee5601365abbcf93ee371922a351844eccff
2023-08-10 15:28:19 -07:00
Treehugger Robot
c5c913b0f5 Merge "Clarify a confusing passage in the docs." into main 2023-08-10 20:32:05 +00:00
Elliott Hughes
9b81e58ff9 Clarify a confusing passage in the docs.
Test: N/A
Change-Id: I23a89cb062982ed292bf62b4c187300b0776aa3d
2023-08-10 19:26:36 +00:00
Elliott Hughes
20ad9129e7 Merge "Rename prop_bt." into main 2023-08-08 18:40:49 +00:00
Elliott Hughes
c37aa7ad3c Rename prop_bt.
Presumably "bt" was "binary tree", but "trie_node" is a bit more
specific and removes the guesswork.

Test: treehugger
Change-Id: Ib5fb2dcbcf261ce516728099d484ed9cd6c069bd
2023-08-08 14:05:01 +00:00
Kalesh Singh
b88dba9a70 Merge "linker_block_alloctor: Remove 4k page size assumption" into main 2023-08-07 23:16:30 +00:00
Treehugger Robot
8b96b46a9e Merge "Use L() in libc/arch-x86_64/bionic/*.S." into main 2023-08-07 19:20:39 +00:00
Dan Albert
1982dce568 Merge changes I1a60d6ef,Idabf0107 into main
* changes:
  Fix result for zero-length non-null conversion.
  Fix mismatched return types for surrogate pairs.
2023-08-07 17:55:09 +00:00
Elliott Hughes
072ff571d9 Use L() in libc/arch-x86_64/bionic/*.S.
I did look at a wider cleanup of libc/arch-x86_64/string/*.S but was
horrified by what I found there, with apparently-useless macros that
may actually be relevant because source files include each other. So
I'll leave the Intel-written stuff alone until/unless I actually have
reason to touch it, and just clean up our corner instead.

Test: treehugger
Change-Id: Id749f79d2fab4a2956efe9e807a067e16cd606ec
2023-08-07 09:34:06 -07:00
Treehugger Robot
6b2aa54a78 Merge "Add the L() macro for local labels to <private/bionic_asm.h>." into main 2023-08-05 00:50:09 +00:00
Kalesh Singh
ff8e00e7bc linker_block_alloctor: Remove 4k page size assumption
Block allocator mmaps arbitary large area ("LinkerBlockAllocatorPage")
of size 4kB * 100. In order to reduce mmap-* syscall and kernel VMA
memory usage.

This works fine for 16kB page size since 100 4kB page are equal to 25
16kB pages.

But for 64kB page size the area will include a partial page (16kB sized
region at the end).

Change the size to 96 4kb pages (6 64kB pages), this will work for all
aarch64 supported page sizes.

And remove the use of PAGE_SIZE

Bug: 294438799
Test: atest -c linker-unit-tests
Change-Id: I7782406d1470183097ce9391c9b70b177e1750e6
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-04 23:08:34 +00:00
Christopher Ferris
636b9b9bf2 Merge "Increase time to set allocation limit." into main 2023-08-04 22:54:05 +00:00
Treehugger Robot
b00078830d Merge "Update NOTICE file." into main 2023-08-04 22:50:15 +00:00
Treehugger Robot
23c97e925c Merge "Fix signature of mbstate_reset_and_return." into main 2023-08-04 22:36:05 +00:00
Treehugger Robot
007bb4d1e8 Merge changes Ia6b8cff4,I390ea200 into main
* changes:
  Make multibyte result constants public.
  Disable 0b parsing test for glibc.
2023-08-04 22:35:29 +00:00
Dan Albert
e1fbf3e15a Merge changes I51c6536e,Ifa0a555e,Iead5eb01,I11236609,Ia307cbd6 into main
* changes:
  Improve output for failed wcsto* tests.
  Add missing setlocale/uselocale for glibc tests.
  Fix test for out of range multibyte characters.
  Fix wchar tests for zero length conversions.
  Fix wcsto*_l tests for glibc.
2023-08-04 22:18:23 +00:00
Elliott Hughes
bc192cff55 Add the L() macro for local labels to <private/bionic_asm.h>.
This lets us remove the riscv64 "sys/asm.h" file. It turns out everyone
loves this macro --- tons of x86 and arm assembler is already using it!

I'll clean up some of the now-duplicate definitions separately, and I'll
move the assembler we wrote ourselves over to this macro (rather than
the current `.L_foo` style) too.

Test: built riscv64 _and_ arm/arm64 _and_ x86/x86-64
Change-Id: If3f93c9b71094a8bed1fd1bb81bb83ec60ce409e
2023-08-04 15:12:30 -07:00
Christopher Ferris
e9ffc52da7 Increase time to set allocation limit.
Under some circumstances, it's possible to fail the enable allocation
limit android_mallopt call. Increase the total allowed time for the
function to complete.

In addition, if the enable fails, allow another limit call to succeed
in the future.

Finally, change the limit test to use _exit instead of exit.

Bug: 291672185

Test: Ran limit test thousands of times.
Test: Forced the limit to fail and verified the second call passes.
Change-Id: I0948e6fd97231a7538b9b82b76f0a207386681b1
2023-08-04 13:10:48 -07:00
Dan Albert
16007d5204 Fix result for zero-length non-null conversion.
Bug: None
Test: deleted the xfail half of the test
Change-Id: I1a60d6ef27ebad14de79ac3bc637a6f2280334d8
2023-08-04 19:48:56 +00:00
Dan Albert
013d747dd3 Fix signature of mbstate_reset_and_return.
Bug: None
Test: None
Change-Id: Ifab9f68f542354fafa8514bf4ea73b185796bdad
2023-08-04 19:48:35 +00:00
Dan Albert
a9e914dd2f Make multibyte result constants public.
The magic numbers that C defines are obnoxious. We had partial
definitions for these internally. Add the missing one and move them to
a public header for anyone else that may want to use them.

Bug: None
Test: None
Change-Id: Ia6b8cff4310bcccb23078c52216528db668ac966
2023-08-04 19:48:35 +00:00
Dan Albert
3a8fed1ac3 Fix mismatched return types for surrogate pairs.
We've had these backward all this time. The relevant quote is in a
code comment in the implementation, but the first call after
completely decoding a code point that requires a surrogate pair should
return the number of bytes decoded by the most recent call, and the
second call should return -3 (if only C had given those some named
constants that might have been more obviously wrong).

Bug: https://issuetracker.google.com/289419882
Test: Fixed the test, tests run against glibc and musl to confirm
Change-Id: Idabf01075b1cad35b604ede8d676d6f0b1dc91e6
2023-08-04 19:48:35 +00:00
Dan Albert
9f30c6ba92 Disable 0b parsing test for glibc.
Bug: None
Test: ran on glibc
Change-Id: I390ea20015f94b26ab3cdbeb6ade6cbcfefa7b0a
2023-08-04 19:48:34 +00:00
Elliott Hughes
a137234742 Update NOTICE file.
I don't know why we seem to keep missing this so much these days...

Test: treehugger
Change-Id: I018a528f35aa938f8fc5cdafe2eaf3f1bbc1a6d9
2023-08-04 12:43:21 -07:00
Elliott Hughes
9a80691e38 Merge "Sync upstream FreeBSD libm." into main 2023-08-04 14:51:38 +00:00
Dan Albert
a40159fa22 Improve output for failed wcsto* tests.
Bug: None
Test: ran these and finally understood which sub-test was failing
Change-Id: I51c6536eba4b9c82ed4b062b1702128e23cf339c
2023-08-03 21:05:29 +00:00
Dan Albert
9f78c51e03 Add missing setlocale/uselocale for glibc tests.
Bug: None
Test: these
Change-Id: Ifa0a555e3a771b27ba733b1316f7531c7b262f8b
2023-08-03 21:05:29 +00:00
Dan Albert
5325653b0f Fix test for out of range multibyte characters.
Same as in uchar_test.cpp: glibc implements a much older unicode
standard which allows these.

Bug: None
Test: this is a test
Change-Id: Iead5eb01d391be85a7b1a034ea9e7f8828e81cdb
2023-08-03 21:04:31 +00:00
Elliott Hughes
4088e3a587 Sync upstream FreeBSD libm.
Test: treehugger
Change-Id: I583a3e93821d512c975db34fc1610ffd22445d58
2023-08-03 13:33:56 -07:00
Dan Albert
512469a858 Fix wchar tests for zero length conversions.
Same as the previous change for the uchar tests: the tests are wrong
to match bionic's wrong implementation. Fix the test to encode the bug
for now while I get the tests into good shape, then I'll be back to
fix the bugs and remove the test differences.

Bug: None
Test: this is a test
Change-Id: I1123660994f755f8bac1f2656f6890d5a43310b3
2023-08-03 20:03:28 +00:00
Dan Albert
686e67d077 Fix wcsto*_l tests for glibc.
glibc immediately dereferences the locale passed to all wcsto*_l
functions, even if it won't be used, and even if it's
LC_GLOBAL_LOCALE, which isn't a pointer to valid memory.

Bug: None
Test: this is the test
Change-Id: Ia307cbd6a5c5b4b904c978a03e6d06c1cef6ceed
2023-08-03 19:59:11 +00:00
Treehugger Robot
e31c863307 Merge "Define gettid symbol when testing on glibc < 2.30" into main 2023-08-03 16:44:11 +00:00
Tomasz Wasilczyk
704e4e6936 Define gettid symbol when testing on glibc < 2.30
Bug: 289414897
Test: it builds
Change-Id: Ic44514953f34096e8a681ef2587439953096ba53
2023-08-03 07:19:17 -07:00
Elliott Hughes
249ae824fd Merge "riscv64: inline raise." into main 2023-08-03 14:07:49 +00:00
Elliott Hughes
0e5b89c4bf riscv64: inline raise.
Not necessary (as demonstrated by the lack of this for x86), but this
saves one stack frame in aborts, which gets you one more useful stack
frame in logs and clustering etc, which improves your chances of finding
your bug.

Test: crasher64 abort
Change-Id: Ieb214f3b46520161edc1e53c0d766353b777d8ba
2023-08-02 16:04:25 -07:00
Matthias Männich
85beaceda3 Merge "libm/libc: remove 'allow_untyped_symbols' flags" into main 2023-08-01 21:33:16 +00:00
Matthias Maennich
68cbdca6bb libm/libc: remove 'allow_untyped_symbols' flags
Those flags were used to suppress ABI tidy errors, but by now are not in
use anymore and can safely be removed.

Bug: 156513478
Change-Id: Ibc9625d139f933e48ebb4ddebe70d424f6231f3f
Signed-off-by: Matthias Maennich <maennich@google.com>
2023-08-01 17:23:49 +00:00
Elliott Hughes
2df6e5fa8f Merge "riscv64: use vdso for __riscv_hwprobe()." into main 2023-08-01 14:32:52 +00:00
Elliott Hughes
95936aec6f Merge "riscv64: pass a null argument to ifunc resolvers." into main 2023-08-01 14:32:35 +00:00
Elliott Hughes
1af07a92d6 Merge "avx2 memset: add missing vzeroupper." into main 2023-08-01 14:08:00 +00:00
Elliott Hughes
b08f79af78 riscv64: pass a null argument to ifunc resolvers.
glibc maintainer Florian Weimer pointed out that glibc passes a null first
argument to riscv64 ifunc resolvers. While not super useful right now,
that does make it much easier to switch to providing arguments in future,
such as my favorite idea of passing a default set of hwprobe key/value
pairs, along with a count of how many pairs.

Test: treehugger
Change-Id: Ibe2148dc28aa6ad230e6324b6d725fe472b7ef33
2023-07-31 19:34:38 +00:00