Browse Source

dedaf1ec1008e987c6bb5d57ef7d4707c5103d11

pg 7 months ago
parent
commit
88fe33ed4e

+ 1 - 1
build/ymake_conf.py

@@ -41,7 +41,7 @@ class WindowsVersion(object):
 ANDROID_API_DEFAULT = 21
 
 # This is default Linux SDK unless `-DOS_SDK` is specified in cmdline
-LINUX_SDK_DEFAULT = "ubuntu-14"
+LINUX_SDK_DEFAULT = "ubuntu-16"
 
 MACOS_VERSION_MIN = "11.0"
 MACOS_VERSION_MIN_AS_INT = "110000"

+ 0 - 6
contrib/libs/libc_compat/ubuntu_14/aligned_alloc.c

@@ -1,6 +0,0 @@
-#include <malloc.h>
-#include <stdlib.h>
-
-__attribute__((weak)) void* aligned_alloc(size_t alignment, size_t size) {
-    return memalign(alignment, size);
-}

+ 0 - 35
contrib/libs/libc_compat/ubuntu_14/c16rtomb.c

@@ -1,35 +0,0 @@
-#include <uchar.h>
-#include <errno.h>
-#include <wchar.h>
-
-size_t c16rtomb(char *restrict s, char16_t c16, mbstate_t *restrict ps)
-{
-	static unsigned internal_state;
-	if (!ps) ps = (void *)&internal_state;
-	unsigned *x = (unsigned *)ps;
-	wchar_t wc;
-
-	if (!s) {
-		if (*x) goto ilseq;
-		return 1;
-	}
-
-	if (!*x && c16 - 0xd800u < 0x400) {
-		*x = c16 - 0xd7c0 << 10;
-		return 0;
-	}
-
-	if (*x) {
-		if (c16 - 0xdc00u >= 0x400) goto ilseq;
-		else wc = *x + c16 - 0xdc00;
-		*x = 0;
-	} else {
-		wc = c16;
-	}
-	return wcrtomb(s, wc, 0);
-
-ilseq:
-	*x = 0;
-	errno = EILSEQ;
-	return -1;
-}

+ 0 - 7
contrib/libs/libc_compat/ubuntu_14/c32rtomb.c

@@ -1,7 +0,0 @@
-#include <uchar.h>
-#include <wchar.h>
-
-size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps)
-{
-	return wcrtomb(s, c32, ps);
-}

+ 0 - 5
contrib/libs/libc_compat/ubuntu_14/features.h

@@ -1,5 +0,0 @@
-#pragma once
-
-#define weak __attribute__((__weak__))
-#define weak_alias(old, new) \
-        extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))

+ 0 - 10
contrib/libs/libc_compat/ubuntu_14/getauxval.cpp

@@ -1,10 +0,0 @@
-#include <sys/auxv.h>
-
-#include "glibc.h"
-#include "features.h"
-
-extern "C" {
-    unsigned long getauxval(unsigned long item) noexcept {
-        return NUbuntuCompat::GetGlibc().GetAuxVal(item);
-    }
-}

+ 0 - 111
contrib/libs/libc_compat/ubuntu_14/glibc.cpp

@@ -1,111 +0,0 @@
-#include <elf.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "glibc.h"
-#include "features.h"
-
-namespace {
-    void ReadAuxVector(Elf64_auxv_t** begin, Elf64_auxv_t** end) noexcept {
-        int fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC);
-        if (fd == -1) {
-            return;
-        }
-
-        constexpr size_t item_size = sizeof(Elf64_auxv_t);
-        constexpr size_t block_size = item_size * 32;
-
-        size_t bytes_read = 0;
-        size_t size = 0;
-
-        struct TBuffer {
-            ~TBuffer() {
-                free(Pointer);
-            }
-            char* Pointer = nullptr;
-        } buffer;
-
-        while (true) {
-            size_t bytes_left = size - bytes_read;
-
-            if (!bytes_left) {
-                size += block_size;
-                char* new_buffer = (char*)realloc(buffer.Pointer, size);
-                if (!new_buffer) {
-                    return;
-                }
-                buffer.Pointer = new_buffer;
-                continue;
-            }
-
-            ssize_t r = read(fd, buffer.Pointer + bytes_read, bytes_left);
-            if (!r) {
-                break;
-            } else if (r < 0) {
-                if (errno == EINTR) {
-                    continue;
-                } else {
-                    return;
-                }
-            }
-
-            bytes_read += r;
-        }
-
-        size_t item_count = bytes_read / item_size;
-        *begin = (Elf64_auxv_t*)buffer.Pointer;
-        *end = (Elf64_auxv_t*)(buffer.Pointer + item_count * item_size);
-        buffer.Pointer = nullptr;
-    }
-}
-
-extern "C" {
-    weak unsigned long __getauxval(unsigned long item);
-}
-
-namespace NUbuntuCompat {
-
-    TGlibc::TGlibc() noexcept
-        : AuxVectorBegin(nullptr)
-        , AuxVectorEnd(nullptr)
-    {
-        if (!__getauxval) {
-            ReadAuxVector((Elf64_auxv_t**)&AuxVectorBegin, (Elf64_auxv_t**)&AuxVectorEnd);
-        }
-
-        Secure = (bool)GetAuxVal(AT_SECURE);
-    }
-
-    TGlibc::~TGlibc() noexcept {
-        free(AuxVectorBegin);
-    }
-
-    unsigned long TGlibc::GetAuxVal(unsigned long item) noexcept {
-        if (__getauxval) {
-            return __getauxval(item);
-        }
-
-        for (Elf64_auxv_t* p = (Elf64_auxv_t*)AuxVectorBegin; p < (Elf64_auxv_t*)AuxVectorEnd; ++p) {
-            if (p->a_type == item) {
-                return p->a_un.a_val;
-            }
-        }
-
-        errno = ENOENT;
-        return 0;
-    }
-
-    bool TGlibc::IsSecure() noexcept {
-        return Secure;
-    }
-
-    static TGlibc __attribute__((__init_priority__(101))) GlibcInstance;
-
-    TGlibc& GetGlibc() noexcept {
-        return GlibcInstance;
-    }
-}

+ 0 - 20
contrib/libs/libc_compat/ubuntu_14/glibc.h

@@ -1,20 +0,0 @@
-#pragma once
-
-typedef unsigned long (*TGetAuxVal)(unsigned long);
-
-namespace NUbuntuCompat {
-    class TGlibc {
-    public:
-        TGlibc() noexcept;
-        ~TGlibc() noexcept;
-        unsigned long GetAuxVal(unsigned long item) noexcept;
-        bool IsSecure() noexcept;
-
-    private:
-        void* AuxVectorBegin;
-        void* AuxVectorEnd;
-        bool Secure;
-    };
-
-    TGlibc& GetGlibc() noexcept;
-}

+ 0 - 30
contrib/libs/libc_compat/ubuntu_14/mbrtoc16.c

@@ -1,30 +0,0 @@
-#include <uchar.h>
-#include <wchar.h>
-
-size_t mbrtoc16(char16_t *restrict pc16, const char *restrict s, size_t n, mbstate_t *restrict ps)
-{
-	static unsigned internal_state;
-	if (!ps) ps = (void *)&internal_state;
-	unsigned *pending = (unsigned *)ps;
-
-	if (!s) return mbrtoc16(0, "", 1, ps);
-
-	/* mbrtowc states for partial UTF-8 characters have the high bit set;
-	 * we use nonzero states without high bit for pending surrogates. */
-	if ((int)*pending > 0) {
- 		if (pc16) *pc16 = *pending;
-		*pending = 0;
-		return -3;
-	}
-
-	wchar_t wc;
-	size_t ret = mbrtowc(&wc, s, n, ps);
-	if (ret <= 4) {
-		if (wc >= 0x10000) {
-			*pending = (wc & 0x3ff) + 0xdc00;
-			wc = 0xd7c0 + (wc >> 10);
-		}
-		if (pc16) *pc16 = wc;
-	}
-	return ret;
-}

+ 0 - 13
contrib/libs/libc_compat/ubuntu_14/mbrtoc32.c

@@ -1,13 +0,0 @@
-#include <uchar.h>
-#include <wchar.h>
-
-size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps)
-{
-	static unsigned internal_state;
-	if (!ps) ps = (void *)&internal_state;
-	if (!s) return mbrtoc32(0, "", 1, ps);
-	wchar_t wc;
-	size_t ret = mbrtowc(&wc, s, n, ps);
-	if (ret <= 4 && pc32) *pc32 = wc;
-	return ret;
-}

Some files were not shown because too many files changed in this diff