From patchwork Tue Oct 15 01:09:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yxj-github-437 <2457369732@qq.com> X-Patchwork-Id: 1997141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=qq.com header.i=@qq.com header.a=rsa-sha256 header.s=s201512 header.b=TLhjCXhN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XSGHj64v9z1xv6 for ; Tue, 15 Oct 2024 12:10:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A26B53857000 for ; Tue, 15 Oct 2024 01:10:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out203-205-221-221.mail.qq.com (out203-205-221-221.mail.qq.com [203.205.221.221]) by sourceware.org (Postfix) with UTF8SMTPS id 57ABB3857000 for ; Tue, 15 Oct 2024 01:09:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57ABB3857000 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=qq.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 57ABB3857000 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=203.205.221.221 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728954591; cv=none; b=w76IyYwX8zgwg4PaZwT88GXIvFlEslPCgx4c0qZVSr6vxrr9rAA0WFvQOw8EEVaLKhl7dXJ9u7sckzoOyHxLygu3n6o0N0XQHfN8HZ+nCkhjMnas8wECSDJcXeHCG0e0O5MVq/lCH2+7CRFFrVLswLzUSTdoUhKgFi3xLNLniW0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728954591; c=relaxed/simple; bh=b/QZCbnRk94eJeUXzTqk8/E9Cc1HItVjHzENkxpogtk=; h=DKIM-Signature:From:To:Subject:Mime-Version:Date:Message-ID; b=bOGOY3T9FrD/U+gbuzBAkKL0Ol6Oh/hZK9Qo4O/gjlqAC7an8doPuDD1G5c4yKnIc2bWBQPzDylubN/c6a4mHAvAocSjBA3R5bBENqBDxQNTvS8rs0ZTHCL6bd0wthSGryq3FdvscXUTpqucnp1LTcQPkxaoSUEKecew3Qy7Zx0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1728954568; bh=FgCmzT0/aI8mQ1ZBkA61cdgcj41Zvct+d8bduUOIV3c=; h=From:To:Subject:Date; b=TLhjCXhN9EpLVXtb58rm4rhPaz08XxZiXQedN+ymFcMD2HEE2SyN01YHJ87XFlXTi w97yaFjEFUmvcsfbOsesAUta2D3RouOYcYN4DdsLNbNGRkk92fZJN9Asr2BLmcF1Yu 8yWWO0JYCqNVulFa0Ft9fhS8bKHeaCqNIGQyeoT8= X-QQ-FEAT: /a4iDlASAVdT59tuMIS2+EB8OCXcq6Ns X-QQ-SSF: 0000000000000090000000000000 X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= X-QQ-XMAILINFO: MtYX1hhLPSb4byTKdBIBoAFUtU2xm6pz/2qUaVFvn9whz0Xtz2jRQvQ0YuZwhP im7dA86Gl2QTQFxUCczB1TAktC58RvLN56iOtQEOkx3r0SF+RWIu8NG7YQVycpo18AgesewsVMK1X EF5H8IewfiO7IfBhepndItYJBtK6oqgx9pF8wQFMf2w+MFkbWC+cTCHGUHKVrawfhtuBCneRlgWt3 DNb12oFts2y2os9gwppZYcFaU72FoROlxv9IRwO8JAsBFrGaT2/535yYtsGyZYDkdZZJMan6Us+Wy VT1JKw3ti4cDQ+nUq87RP8yiEl0yTL7A7ENa3g4gYigQ8uCTdXW6q19HaNC3qHFdEv4co7WZW1LvQ gw04r0vJxQk0VhotedBfa800cVsuvFp/t+F6Wc+uXj0o0h6aZA9LUeELOuoH5Ukx25yFWaaaw5hxL fMOY0Dni0iYpQGfu2OWyo8rFKBEXjRMGqO3PsEoUfNEM8jO4qwcgmnt7X1qDNPWU085spnCDX+peb wpMLuj0HTWEnB5UnSanWuHcqZ40OzkUj6IwotDGBYAzbmzeHUb7NIPSdc2pxGf57zz2MugZ3xGo5B ZgVvkLCwsc+T2auJpzzvoYiSxVrKljRyAdu/q3ruCAI72EKYml6SLMLrngzNad1hpGyrJKl0RvQnR 1CMQdUUBKUJ/1bzQQTLmhAPauP0x9AAhCM4ePrRhXvumR8o8gGAqPsB7mi5USeRa12bR6ps4jvGeH k7ie3a7bz2fKrgz7aj/c7wPZq9RJe0Vl7t3H5TZ1UnSI/2/MpTGWTAtaEE7CtttC4wuNGpT6aLVyu qViei+5iSxiQKSzfJ4lGwHen0IUWEYK0EkpJCskzABIQ5LbMDTGLFOz+2WOjDnruTx8vQ7NzVUqfg wQw93F3Uf7zIpnpCrCyAHicXfcPnTvkxWt1bKYu+8LY9X2y9CVyuMSG9gmkVuVW4w3nui2jc2c= X-HAS-ATTACH: no X-QQ-BUSINESS-ORIGIN: 2 X-Originating-IP: 123.139.36.48 X-QQ-STYLE: X-QQ-mid: webmail871t1728954568t5856872 From: " =?iso-8859-1?q?yxj-github-437?= " <2457369732@qq.com> To: " =?iso-8859-1?q?gcc-patches?= " Subject: [PATCH] Android: Fix build for Android Mime-Version: 1.0 Date: Tue, 15 Oct 2024 09:09:27 +0800 X-Priority: 3 Message-ID: X-QQ-MIME: TCMime 1.0 by Tencent X-Mailer: QQMail 2.x X-QQ-Mailer: QQMail 2.x X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, FROM_EXCESS_BASE64, GIT_PATCH_0, HELO_DYNAMIC_IPADDR, HTML_MESSAGE, NO_FM_NAME_IP_HOSTN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RDNS_DYNAMIC, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org gcc/ * config.gcc: fix target aarch64-linux-android, arm-linux-androideabi, i686-linux-android, x86_64-linux-android * config/linux-android.h: fix SPEC based on aarch64-linux-android-clang * config/aarch64/aarch64-elf.h: Add Macro DEFAULT_ASM_SPEC * config/aarch64/aarch64-linux.h: Add BIONIC_DYNAMIC_LINKER, fix SPEC for aarch64-android * config/aarch64/t-linux-android: New file for aarch64-android muiltarch * config/arm/elf.h: Add Macro DEFAULT_ASM_SPEC * config/arm/linux-eabi.h: Add Macro ASM_SPEC * config/arm/t-linux-androideabi: fix MULTILIB, MULTIARCH * config/gcc/i386/t-linux-android: New file for adding i686-linux-android MULTIARCH * config/gcc/i386/t-linux64-android: New file for adding x86_64-linux-android MULTILIB libgcc/ * config/i386/heap-trampoline.c: Allow x86-android platforms in heap trampolines. libphobos/ * libdruntime/core/stdc/stdio.d: fix stdin,stdout,stderr symbol conflict for android api-level>=23 * libdruntime/gcc/sections/elf.d: for CRuntime_Bionic, SharedELF is true * libdruntime/gcc/sections/package.d: CRuntime_Bionic platform is SectionsElf platform libstdc++-v3/ * config/os/bionic: fix CTYPE undefine ---  gcc/config.gcc                               | 25 +++++++++++-  gcc/config/aarch64/aarch64-elf.h             |  8 +++-  gcc/config/aarch64/aarch64-linux.h           | 42 ++++++++++++++++++--  gcc/config/aarch64/t-linux-android           |  4 ++  gcc/config/arm/elf.h                         |  8 +++-  gcc/config/arm/linux-eabi.h                  |  6 +++  gcc/config/arm/t-linux-androideabi           |  6 ++-  gcc/config/i386/t-linux-android              |  1 +  gcc/config/i386/t-linux64-android            |  3 ++  gcc/config/linux-android.h                   | 14 +++++--  libgcc/config/i386/heap-trampoline.c         |  2 +-  libphobos/libdruntime/core/stdc/stdio.d      |  9 +++--  libphobos/libdruntime/gcc/sections/elf.d     |  1 +  libphobos/libdruntime/gcc/sections/package.d |  1 +  libstdc++-v3/config/os/bionic/ctype_base.h   | 22 +++++-----  15 files changed, 124 insertions(+), 28 deletions(-)  create mode 100644 gcc/config/aarch64/t-linux-android  create mode 100644 gcc/config/i386/t-linux-android  create mode 100644 gcc/config/i386/t-linux64-android -- 2.34.1 diff --git a/gcc/config.gcc b/gcc/config.gcc index 71ac3badafd..8951567f788 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1241,14 +1241,18 @@ aarch64*-*-netbsd*)   extra_options="${extra_options} netbsd.opt netbsd-elf.opt"   ;;  aarch64*-*-linux*) - tm_file="${tm_file} elfos.h gnu-user.h linux.h glibc-stdint.h" + tm_file="${tm_file} elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h"   tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-linux.h" + extra_options="${extra_options} linux-android.opt"   tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux"   tm_defines="${tm_defines}  TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"   case $target in   aarch64_be-*)   tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"   ;; + *-android) +        tmake_file="${tmake_file} aarch64/t-linux-android" +        ;;   esac   aarch64_multilibs="${with_multilib_list}"   if test "$aarch64_multilibs" = "default"; then @@ -1476,6 +1480,7 @@ arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)   case ${target} in   *-androideabi)       tmake_file="$tmake_file arm/t-linux-androideabi" +     target_cpu_cname="generic-armv7-a"       ;;   esac   # The EABI requires the use of __cxa_atexit. @@ -2022,6 +2027,12 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-gnu* | i[34567]8   tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"   tm_defines="${tm_defines} TARGET_BI_ARCH=1"   tmake_file="${tmake_file} i386/t-linux64" + # Define multilib configuration for i686-linux-android. +            case ${target} in +            *-android) +                tmake_file="$tmake_file i386/t-linux64-android" +                ;; +            esac   x86_multilibs="${with_multilib_list}"   if test "$x86_multilibs" = "default"; then   x86_multilibs="m64,m32" @@ -2085,6 +2096,12 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-gnu*)   ;;   esac   tmake_file="${tmake_file} i386/t-linux64" + # Define multilib configuration for x86_64-linux-android. +    case ${target} in +    *-android) +        tmake_file="$tmake_file i386/t-linux64-android" +        ;; +    esac   x86_multilibs="${with_multilib_list}"   if test "$x86_multilibs" = "default"; then   case ${with_abi} in @@ -5892,6 +5909,12 @@ case ${target} in   i[34567]86-*-linux* | x86_64-*-linux*)   extra_objs="${extra_objs} gnu-property.o"   tmake_file="$tmake_file i386/t-linux i386/t-gnu-property" + # Define multilib configuration for i686-linux-android. +        case ${target} in +        *-android) +            tmake_file="$tmake_file i386/t-linux-android" +            ;; +        esac   ;;   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)   tmake_file="$tmake_file i386/t-kfreebsd" diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h index b6fb7936789..a1ace46ebb2 100644 --- a/gcc/config/aarch64/aarch64-elf.h +++ b/gcc/config/aarch64/aarch64-elf.h @@ -132,8 +132,8 @@  #define ASM_MABI_SPEC "%{mabi=lp64:}"  #endif -#ifndef ASM_SPEC -#define ASM_SPEC "\ +#ifndef DEFAULT_ASM_SPEC +#define DEFAULT_ASM_SPEC "\  %{mbig-endian:-EB} \  %{mlittle-endian:-EL} \  %{march=*:-march=%*} \ @@ -141,6 +141,10 @@  ASM_MABI_SPEC  #endif +#ifndef ASM_SPEC +# define ASM_SPEC DEFAULT_ASM_SPEC +#endif +  #undef TYPE_OPERAND_FMT  #define TYPE_OPERAND_FMT "%%%s" diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h index 8e51c8202cc..a6b20ac4992 100644 --- a/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h @@ -23,6 +23,11 @@  #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" +#ifdef BIONIC_DYNAMIC_LINKER +#undef BIONIC_DYNAMIC_LINKER +#endif +#define BIONIC_DYNAMIC_LINKER "/system/bin/linker64" +  #undef MUSL_DYNAMIC_LINKER  #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" @@ -30,7 +35,18 @@  #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"  #undef  CC1_SPEC -#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC +#define CC1_SPEC LINUX_OR_ANDROID_CC(GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC, \ +GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC " " ANDROID_CC1_SPEC) + +#define CC1PLUS_SPEC \ +  LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) + +#undef ASM_SPEC +#define ASM_SPEC \ +  LINUX_OR_ANDROID_CC (DEFAULT_ASM_SPEC, \ +  DEFAULT_ASM_SPEC  " " \ +  ANDROID_ASM_SPEC) +  #define CPP_SPEC "%{pthread:-D_REENTRANT}" @@ -46,21 +62,41 @@     %{mbig-endian:-EB} %{mlittle-endian:-EL}     \     -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}" +#undef LIB_SPEC +#define LIB_SPEC \ +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ +     GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC " " ANDROID_LIB_SPEC) -#define LINK_SPEC LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC +#define LINK_SPEC \ +LINUX_OR_ANDROID_LD(LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC, \ +LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_SPEC " " \ +ANDROID_LINK_SPEC)  #define GNU_USER_TARGET_MATHFILE_SPEC \    "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}" +#ifdef TARGET_ANDROID +#undef LIBGCC2_UNWIND_ATTRIBUTE +#define LIBGCC2_UNWIND_ATTRIBUTE \ +   __attribute__((visibility("default"))) +#endif + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ +  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) +  #undef ENDFILE_SPEC  #define ENDFILE_SPEC   \    GNU_USER_TARGET_MATHFILE_SPEC " " \ -  GNU_USER_TARGET_ENDFILE_SPEC +  LINUX_OR_ANDROID_LD( \ +  GNU_USER_TARGET_ENDFILE_SPEC, \ +  ANDROID_ENDFILE_SPEC)  #define TARGET_OS_CPP_BUILTINS() \    do \      { \   GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + ANDROID_TARGET_OS_CPP_BUILTINS();  \      } \    while (0) diff --git a/gcc/config/aarch64/t-linux-android b/gcc/config/aarch64/t-linux-android new file mode 100644 index 00000000000..e326d055d96 --- /dev/null +++ b/gcc/config/aarch64/t-linux-android @@ -0,0 +1,4 @@ +MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-android) +MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-android) + +MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-android_ilp32) diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h index 97230d19a36..5342dc898c0 100644 --- a/gcc/config/arm/elf.h +++ b/gcc/config/arm/elf.h @@ -56,8 +56,8 @@  #undef SUBSUBTARGET_EXTRA_SPECS  #define SUBSUBTARGET_EXTRA_SPECS -#ifndef ASM_SPEC -#define ASM_SPEC "\ +#ifndef DEFAULT_ASM_SPEC +#define DEFAULT_ASM_SPEC "\  %{mbig-endian:-EB} \  %{mlittle-endian:-EL} \  %(asm_cpu_spec) \ @@ -68,6 +68,10 @@  %(subtarget_extra_asm_spec)"  #endif +#ifndef ASM_SPEC +# define ASM_SPEC DEFAULT_ASM_SPEC +#endif +  /* The ARM uses @ are a comment character so we need to redefine     TYPE_OPERAND_FMT.  */  #undef  TYPE_OPERAND_FMT diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index eef791f6a02..93442bd87e7 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -110,6 +110,12 @@  #define CC1PLUS_SPEC \    LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) +#undef ASM_SPEC +#define ASM_SPEC \ +  LINUX_OR_ANDROID_CC (DEFAULT_ASM_SPEC, \ +  DEFAULT_ASM_SPEC  " " \ +  ANDROID_ASM_SPEC) +  #undef  LIB_SPEC  #define LIB_SPEC \    LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ diff --git a/gcc/config/arm/t-linux-androideabi b/gcc/config/arm/t-linux-androideabi index 8f1307c557f..9ffab1e1e9e 100644 --- a/gcc/config/arm/t-linux-androideabi +++ b/gcc/config/arm/t-linux-androideabi @@ -1,9 +1,11 @@ -MULTILIB_OPTIONS     = march=armv7-a mthumb -MULTILIB_DIRNAMES    = armv7-a thumb +MULTILIB_OPTIONS     = +MULTILIB_DIRNAMES    =  MULTILIB_EXCEPTIONS  =  MULTILIB_MATCHES     =  MULTILIB_OSDIRNAMES  = +MULTIARCH_DIRNAME = $(call if_multiarch,arm$(ARM_EB)-linux-androideabi$(if $(filter hard,$(with_float)),hf)) +  # The "special" multilib can be used to build native applications for Android,  # as opposed to native shared libraries that are then called via JNI.  #MULTILIB_OPTIONS    += tno-android-cc diff --git a/gcc/config/i386/t-linux-android b/gcc/config/i386/t-linux-android new file mode 100644 index 00000000000..d17d060ea96 --- /dev/null +++ b/gcc/config/i386/t-linux-android @@ -0,0 +1 @@ +MULTIARCH_DIRNAME = $(call if_multiarch,i686-linux-android) diff --git a/gcc/config/i386/t-linux64-android b/gcc/config/i386/t-linux64-android new file mode 100644 index 00000000000..c2e3c8ecb92 --- /dev/null +++ b/gcc/config/i386/t-linux64-android @@ -0,0 +1,3 @@ +MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-android) +MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i686-linux-android) +MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-androidx32) diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h index 5f5ccd4e0f4..b23f098d312 100644 --- a/gcc/config/linux-android.h +++ b/gcc/config/linux-android.h @@ -38,15 +38,23 @@    "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}"  #define ANDROID_LINK_SPEC \ -  "%{shared: -Bsymbolic}" +  "%{shared: -Bsymbolic}  -z noexecstack -z relro -z now"  #define ANDROID_CC1_SPEC \    "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \    "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"  #define ANDROID_CC1PLUS_SPEC \ -  "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ -  "%{!frtti:%{!fno-rtti: -fno-rtti}}" +  "%{!fexceptions:%{!fno-exceptions: -fexceptions}} " \ +  "%{!frtti:%{!fno-rtti: -frtti}}" + +#ifdef HAVE_LD_EH_FRAME_HDR +#undef LINK_EH_SPEC +#define LINK_EH_SPEC "--eh-frame-hdr  " +#endif + +#define ANDROID_ASM_SPEC \ +  "--noexecstack"  #define ANDROID_LIB_SPEC \    "%{!static: -ldl}" diff --git a/libgcc/config/i386/heap-trampoline.c b/libgcc/config/i386/heap-trampoline.c index a8637dc92d3..1b94b3ca9a7 100644 --- a/libgcc/config/i386/heap-trampoline.c +++ b/libgcc/config/i386/heap-trampoline.c @@ -141,7 +141,7 @@ allocate_trampoline_page (void)  {    void *page; -#if defined(__gnu_linux__) +#if defined(__linux__) || defined(__gnu_hurd__)    page = mmap (0, getpagesize (), PROT_WRITE | PROT_EXEC,          MAP_ANON | MAP_PRIVATE, 0, 0);  #elif __APPLE__ diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d index 1fc046163ee..ca2b5b4b441 100644 --- a/libphobos/libdruntime/core/stdc/stdio.d +++ b/libphobos/libdruntime/core/stdc/stdio.d @@ -1187,12 +1187,15 @@ else version (CRuntime_Bionic)      private extern shared FILE[3] __sF; +    @property auto __stdin()() { return &__sF[0]; } +    @property auto __stdout()() { return &__sF[1]; } +    @property auto __stderr()() { return &__sF[2]; }      /// -    @property auto stdin()() { return &__sF[0]; } +    alias __stdin stdin;      /// -    @property auto stdout()() { return &__sF[1]; } +    alias __stdout stdout;      /// -    @property auto stderr()() { return &__sF[2]; } +    alias __stderr stderr;  }  else version (CRuntime_Musl)  { diff --git a/libphobos/libdruntime/gcc/sections/elf.d b/libphobos/libdruntime/gcc/sections/elf.d index a67dd4a42b6..12bc9fb7b30 100644 --- a/libphobos/libdruntime/gcc/sections/elf.d +++ b/libphobos/libdruntime/gcc/sections/elf.d @@ -30,6 +30,7 @@ version (S390)    version = IBMZ_Any;  version (SystemZ) version = IBMZ_Any;  version (CRuntime_Glibc) enum SharedELF = true; +else version (CRuntime_Bionic) enum SharedELF = true;  else version (CRuntime_Musl) enum SharedELF = true;  else version (FreeBSD) enum SharedELF = true;  else version (NetBSD) enum SharedELF = true; diff --git a/libphobos/libdruntime/gcc/sections/package.d b/libphobos/libdruntime/gcc/sections/package.d index 6a245944387..f05b8ea7f61 100644 --- a/libphobos/libdruntime/gcc/sections/package.d +++ b/libphobos/libdruntime/gcc/sections/package.d @@ -23,6 +23,7 @@  module gcc.sections;  version (CRuntime_Glibc)  version = SectionsElf; +version (CRuntime_Bionic) version = SectionsElf;  version (CRuntime_Musl)   version = SectionsElf;  version (CRuntime_UClibc) version = SectionsElf;  version (FreeBSD)         version = SectionsElf; diff --git a/libstdc++-v3/config/os/bionic/ctype_base.h b/libstdc++-v3/config/os/bionic/ctype_base.h index e93f90a62be..0134ddb3f5b 100644 --- a/libstdc++-v3/config/os/bionic/ctype_base.h +++ b/libstdc++-v3/config/os/bionic/ctype_base.h @@ -41,17 +41,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION      // NB: Offsets into ctype