Mint APE Loader v1.5

This change ports APE Loader to Linux AARCH64, so that Raspberry Pi
users can run programs like redbean, without the executable needing
to modify itself. Progress has also slipped into this change on the
issue of making progress better conforming to user expectations and
industry standards regarding which symbols we're allowed to declare
This commit is contained in:
Justine Tunney 2023-07-26 13:54:49 -07:00
parent 6843150e0c
commit 7e0a09feec
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
510 changed files with 1783 additions and 1483 deletions

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "third_party/mbedtls/bignum.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/bsf.h"
#include "libc/intrin/bswap.h"
@ -23,7 +24,6 @@
#include "libc/nexgen32e/x86feature.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/mbedtls/bignum.h"
#include "third_party/mbedtls/bignum_internal.h"
#include "third_party/mbedtls/chk.h"
#include "third_party/mbedtls/common.h"
@ -291,7 +291,7 @@ int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X,
for (i = 0; i < Y->n; i++)
X->p[i] = Select(Y->p[i], X->p[i], -assign);
for (i = Y->n; i < X->n; i++)
X->p[i] &= CONCEAL("r", assign - 1);
X->p[i] &= __conceal("r", assign - 1);
cleanup:
return( ret );
}

View file

@ -52,7 +52,7 @@ COSMOPOLITAN_C_START_
#define MBEDTLS_ASSERT(EXPR) \
((void)((EXPR) || (__assert_fail(#EXPR, __FILE__, __LINE__), 0)))
#else
#define MBEDTLS_ASSERT(EXPR) _unassert(EXPR)
#define MBEDTLS_ASSERT(EXPR) unassert(EXPR)
#endif
typedef struct mbedtls_platform_context {

View file

@ -15,6 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "third_party/mbedtls/rsa.h"
#include "libc/intrin/strace.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/rand.h"
@ -24,7 +25,6 @@
#include "third_party/mbedtls/oid.h"
#include "third_party/mbedtls/platform.h"
#include "third_party/mbedtls/profile.h"
#include "third_party/mbedtls/rsa.h"
#include "third_party/mbedtls/rsa_internal.h"
#include "third_party/mbedtls/sha1.h"
@ -1353,8 +1353,8 @@ forceinline unsigned size_greater_than( size_t size, size_t max )
forceinline unsigned if_int( unsigned cond, unsigned if1, unsigned if0 )
{
unsigned mask = all_or_nothing_int( cond );
return( ( CONCEAL( "r", mask ) & if1 ) |
( CONCEAL( "r", ~mask ) & if0 ) );
return( ( __conceal( "r", mask ) & if1 ) |
( __conceal( "r", ~mask ) & if0 ) );
}
/**

View file

@ -234,7 +234,7 @@ void secp384r1(uint64_t p[12]) {
p[4] = E;
p[5] = F;
p[6] = G;
G = CONCEAL("r", 0L);
G = __conceal("r", 0L);
p[7] = G;
p[8] = G;
p[9] = G;

View file

@ -4,7 +4,7 @@
COSMOPOLITAN_C_START_
static inline uint64_t Select(uint64_t a, uint64_t b, uint64_t mask) {
return (CONCEAL("r", mask) & a) | (CONCEAL("r", ~mask) & b);
return (__conceal("r", mask) & a) | (__conceal("r", ~mask) & b);
}
COSMOPOLITAN_C_END_

View file

@ -50,7 +50,7 @@ Copyright ARM Limited\\n\
Copyright Mbed TLS Contributors\"");
asm(".include \"libc/disclaimer.inc\"");
STATIC_YOINK("zipos");
__static_yoink("zipos");
#if defined(MBEDTLS_PLATFORM_C)
static mbedtls_platform_context platform_ctx;

View file

@ -13,4 +13,4 @@ Copyright ARM Limited\\n\
Copyright Mbed TLS Contributors\"");
asm(".include \"libc/disclaimer.inc\"");
STATIC_YOINK("zipos");
__static_yoink("zipos");

View file

@ -20,7 +20,7 @@
#include "third_party/mbedtls/platform.h"
// disable ubsan because n=0 is defined behavior in cosmopolitan
noubsan void mbedtls_platform_zeroize(void *p, size_t n) {
dontubsan void mbedtls_platform_zeroize(void *p, size_t n) {
MBEDTLS_INTERNAL_VALIDATE(!n || p);
bzero(p, n);
}