Message ID | Y+Nu6les4SuFnrsB@guest.guest |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3359618wrn; Wed, 8 Feb 2023 01:44:57 -0800 (PST) X-Google-Smtp-Source: AK7set+0WDAYGWnn+aQffdreSuUHXE6xxrdrnYSYlkV1LMs7sQK9aiog9MAqK54SKzCSdboJ+gW7 X-Received: by 2002:a17:907:d19:b0:884:26ec:388b with SMTP id gn25-20020a1709070d1900b0088426ec388bmr9325423ejc.39.1675849497116; Wed, 08 Feb 2023 01:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675849497; cv=none; d=google.com; s=arc-20160816; b=Zb+QNH0Am+Pk0jqyyF0s3gW3FrgQDstdfXubwDZVUpF/fyOi+LOnqaVSvGW8teU7aY syTDR4gE8Y5ZbRz8GQstKaiQBitM80QHi0srjy7KOEje3dD5KOnQZsezhCl0X6yTYzSH vtoxslJEVjhxVJIGddxy+NTvCt15UMemGmRmEOuIVpsxMOL/UWNe9j8oEm/xJ/PZ0wNi oU2dlUzeb55Yyt0KTgivTAuzAyWROB1X4l4kbvoci8xNkvzK8SCjsef7DSx9RyFZo4vp VZJygSCSf6FaaOoILEgesGMCaq+iyt6ZlpSTdnpVj3/d21pkPZRUMcc4Ut1FmATe5q3K fqOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Gd+fyEoDswZ9x7j+Z23AcCnpLgL5djIc5xRmTVvdylY=; b=xphU5dj0rcKdNvf2HgUkaoJk0XIXRcuzX91pGhOWuGQAKAkSnOHEeEgn6brdcx+UUY 30/yJj/cwOkIdhoN4Ex/D62F8PptUTO2k8qrxgGr2LeI5PsRfuRuhWjXnJD6kOWVHiQr Vsd1/31rUkYfABrK5az6JBStVPK+x9UZaiZxC6yWDmMFSLvVx3L2oG7xmEWHoxkYtV57 NPXD/+w9onSyDTRGnXNOMOhWeFuratGhb0P9I4oS/y+ljUdCp00SAVgbew9m2wT/RbBx dnuokutoOijZRahzY4Ttxtwl9EY9Hh3ct9wJCDyX7pezIMnPrC3YKSX+UdxUgMeiEfm+ /RDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=jkDBiPko; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k8-20020a1709062a4800b0087876646d4esi20126665eje.471.2023.02.08.01.44.56 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 01:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=jkDBiPko; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7D193858024 for <ouuuleilei@gmail.com>; Wed, 8 Feb 2023 09:44:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7D193858024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675849495; bh=Gd+fyEoDswZ9x7j+Z23AcCnpLgL5djIc5xRmTVvdylY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jkDBiPkoBQJ7hNoyfgfXogdhncpoym0jo5qoRmpzV2ZLiti8C1Ojfc1OXrVRBgg+K c2zCTe31E66EON9oVCTZLf7PbqwbsEQ7o33kdcNjwjqUohqphNkvHlQa1ioAVh+Kqo oVy2aGHm/C1am1MKxmqj9ngo4uFVK37PkVfE/SIw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by sourceware.org (Postfix) with ESMTPS id 99BD53858D39 for <gcc-patches@gcc.gnu.org>; Wed, 8 Feb 2023 09:44:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99BD53858D39 Received: by mail-qt1-x82f.google.com with SMTP id f10so20065008qtv.1 for <gcc-patches@gcc.gnu.org>; Wed, 08 Feb 2023 01:44:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Gd+fyEoDswZ9x7j+Z23AcCnpLgL5djIc5xRmTVvdylY=; b=PrUsPW1nuApdtgl/BdG/WH+w+oekQ40+mz2ff0/ZjWl1yfmpsmyTghM4lN2ayHXIpy CSkLWqfedQ4Arxem0FD0OLLcTbfVYmjU4s2XLbAY1R4XswXQ530Tfvox9tRvOZMGWhHW UjEITgX8NbvAdT5zW0qUmTZQuAZDtY8ToHCR2pAtntyxrLF5Ngy32l/F/VIEmotkNH9U a/h2qbykzmaEwfwKBN2/spax7SdIHY8Cpi/pZM6ixlYvXpJyVj8BK9z4Ugwwu8SpCJaF akpW5YTABf0aKcXCkMAzBKXV9CxPRSx+cB1UqXavGZ7yweAPe4H/WlxHE5HVirFoiVsx 3AVw== X-Gm-Message-State: AO0yUKWROFbOdW88+lf1/1CTb1iWUth2FnxY8BYKVAh/s1G+zgxld0Ei Lh4r8f8jHY2YwxQCcxSOKnCyoj7VyHk= X-Received: by 2002:a05:622a:1394:b0:3ba:1d8d:f6eb with SMTP id o20-20020a05622a139400b003ba1d8df6ebmr10181650qtk.58.1675849451881; Wed, 08 Feb 2023 01:44:11 -0800 (PST) Received: from localhost ([2001:19f0:5:4a87:5400:3ff:feba:e632]) by smtp.gmail.com with ESMTPSA id g7-20020ac87d07000000b003b9a50c8fa1sm11373974qtb.87.2023.02.08.01.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 01:44:10 -0800 (PST) Date: Wed, 8 Feb 2023 17:44:10 +0800 To: Eric Botcazou <ebotcazou@adacore.com>, Marc =?utf-8?b?UG91bGhpw6hz?= <poulhies@adacore.com>, gcc-patches@gcc.gnu.org Subject: [PATCH] ada: Fix musl build on Linux Message-ID: <Y+Nu6les4SuFnrsB@guest.guest> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?b?5a6L5Yas55SfIHZpYSBHY2MtcGF0Y2hlcw==?= <gcc-patches@gcc.gnu.org> Reply-To: =?utf-8?b?5a6L5Yas55Sf?= <dongsheng.song@gmail.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757255562621163749?= X-GMAIL-MSGID: =?utf-8?q?1757255562621163749?= |
Series |
ada: Fix musl build on Linux
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
宋冬生
Feb. 8, 2023, 9:44 a.m. UTC
The commit "ada: Add PIE support to backtraces on Linux" [1] use _r_debug under Linux unconditionally. It is incorrect since musl[2] libc not defined _r_debug like glibc [3]: extern struct r_debug _r_debug; As far as I know, only glibc and uClibc [4] define the global variable _r_debug. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=f2b30a724e6bf7ff8e591b176967d596cee7648e;hp=83e8d37fe39d7c1afce19b61bbc2dd828fa37c6f [2] https://git.musl-libc.org/cgit/musl/tree/include/link.h#n39 [3] https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/link.h;h=3b5954d9818e8ea9f35638c55961f861f6ae6057;hb=HEAD#l66 [4] https://git.uclibc.org/uClibc/tree/include/link.h#n71 OK? Bootstrapped and tested on aarch64-linux-(gnu|musl), riscv64-linux-(gnu|musl) and x86_64-linux-(gnu|musl) with no regressions. gcc/ada/ * adaint.c [Linux]: Include <features.h>. (__gnat_get_executable_load_address) [Linux]: Enable only for glibc & uClibc on Linux. gcc/ada/adaint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
> The commit "ada: Add PIE support to backtraces on Linux" [1] use > _r_debug under Linux unconditionally. It is incorrect since musl[2] > libc not defined _r_debug like glibc [3]: > > extern struct r_debug _r_debug; > > As far as I know, only glibc and uClibc [4] define the global variable > _r_debug. > > > [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=f2b30a724e6bf7ff8e591b176967d596cee7648e;hp=83e8d37fe39d7c1afce19b61bbc2dd828fa37c6f > [2] https://git.musl-libc.org/cgit/musl/tree/include/link.h#n39 > [3] https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/link.h;h=3b5954d9818e8ea9f35638c55961f861f6ae6057;hb=HEAD#l66 > [4] https://git.uclibc.org/uClibc/tree/include/link.h#n71 > > OK? Bootstrapped and tested on aarch64-linux-(gnu|musl), > riscv64-linux-(gnu|musl) and x86_64-linux-(gnu|musl) with no regressions. OK, thanks, > gcc/ada/ > > * adaint.c [Linux]: Include <features.h>. > (__gnat_get_executable_load_address) [Linux]: Enable only for glibc & uClibc > on Linux.
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 1c23d1584..852209416 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -3526,6 +3526,7 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) #if defined (__APPLE__) #include <mach-o/dyld.h> #elif defined (__linux__) +#include <features.h> #include <link.h> #endif @@ -3535,7 +3536,7 @@ __gnat_get_executable_load_address (void) #if defined (__APPLE__) return _dyld_get_image_header (0); -#elif defined (__linux__) +#elif defined (__linux__) && (defined (__GLIBC__) || defined (__UCLIBC__)) struct link_map *map = _r_debug.r_map; return (const void *)map->l_addr;