Message ID | d198f1806a486bd5129c996f10680b947ecdc581.1712087613.git.quic_mathbern@quicinc.com |
---|---|
State | Superseded |
Headers |
Return-Path: <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E580386EC13 for <patchwork@sourceware.org>; Tue, 2 Apr 2024 19:56:27 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id BCDCE386C5B9 for <elfutils-devel@sourceware.org>; Tue, 2 Apr 2024 19:56:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCDCE386C5B9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BCDCE386C5B9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712087773; cv=none; b=q+OE/nmHUnb716FNCTD01ZLa9AbR3wyqu8E2Nl5u5fOS530C/IJBYDnXCpN+8vMxQ3GE6zIAVGHlrAz1yypSxwgevwb2bpQ6M/rWjnEgZI6+yNceJP1XQz30589b5f7GPmtLHq0NFh1PppxEWjdDZO76iHyCLKtCBcnkpEuZSd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712087773; c=relaxed/simple; bh=CQf9kmQmEaa8eiNtdAKA7GU/+WQ00Q/rUlJFqhHJC6c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IsWqQ1h3v6M2XFXEPlyJ9O+F81iLXWmNS6DIHp0uoVPhR1s1MJYXLf3Snjo3Ox1kPj76A7Fa4M46yJcZsr0+xKlCzkLDo8S/VA/7Xk8i3nE0ayPKwjP011VohOyHk3e1XYd62c/1LYyWEdv97zebc8prY/9YmVbXPP/pBiWByAE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 432J7ITv016090; Tue, 2 Apr 2024 19:56:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=ejEEm4Mh5b3ExzSfy6tHJGDd2Z38y1das7pqs+KPHY8=; b=Yj Tl4UcElmRf0KEFXwGD2gU/9lG1yapgb3rvPhUczelO5PVjk1UmhyAMJbDCoeL2Ue oxiA4m5KlZVvg2uNUXznD9HKhNkyJ4nlIosC5Y1YbRaLLskZeqaDiQ2cLamJaSO4 VnZadllniGa8lPL5Cb0UacaOz7sPgtCbrLiEjoYcKjJDmvmenqMDuABOdfabiAAV Q+4wyKhDy8gYueefAbqwSkSQIPVeWougOviEPwfJimLmqSSdsmcqsUErKXM9ANSj eBRdgg8o0MVhLK1DY4KqccalK3PLAMOnhisiWiFIjGS/nrxVxmNu2NaRMDEPGsMB 6mXjH6iicI/UKH0QZo6Q== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x8h5esc6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Apr 2024 19:56:01 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 432Ju01k013459 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 2 Apr 2024 19:56:00 GMT Received: from hu-mathbern-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 2 Apr 2024 12:56:00 -0700 From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> To: <elfutils-devel@sourceware.org> CC: <bcain@quicinc.com>, <sidneym@quicinc.com>, <mark@klomp.org>, <quic_apinski@quicinc.com>, <quic_mathbern@quicinc.com> Subject: [PATCH v2 2/2] Hexagon: implement machine flag check Date: Tue, 2 Apr 2024 16:55:46 -0300 Message-ID: <d198f1806a486bd5129c996f10680b947ecdc581.1712087613.git.quic_mathbern@quicinc.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <cover.1712087613.git.quic_mathbern@quicinc.com> References: <cover.1712087613.git.quic_mathbern@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 9AS-PdB5s7DEq6VPtsj0ApgSTtoT7Zuu X-Proofpoint-ORIG-GUID: 9AS-PdB5s7DEq6VPtsj0ApgSTtoT7Zuu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-02_13,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=663 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404020147 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Post: <mailto:elfutils-devel@sourceware.org> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Add initial support for Hexagon
|
|
Commit Message
Matheus Tavares Bernardino
April 2, 2024, 7:55 p.m. UTC
This fixes the "invalid machine flag" error from eu-elflint when passing
hexagon binaries.
Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
backends/hexagon_init.c | 1 +
backends/hexagon_symbol.c | 8 ++++++++
2 files changed, 9 insertions(+)
Comments
> -----Original Message----- > From: Matheus Bernardino (QUIC) <quic_mathbern@quicinc.com> > Sent: Tuesday, April 2, 2024 2:56 PM > To: elfutils-devel@sourceware.org > Cc: Brian Cain <bcain@quicinc.com>; Sid Manning <sidneym@quicinc.com>; > mark@klomp.org; Andrew Pinski (QUIC) <quic_apinski@quicinc.com>; > Matheus Bernardino (QUIC) <quic_mathbern@quicinc.com> > Subject: [PATCH v2 2/2] Hexagon: implement machine flag check > > This fixes the "invalid machine flag" error from eu-elflint when passing > hexagon binaries. > > Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> > --- > backends/hexagon_init.c | 1 + > backends/hexagon_symbol.c | 8 ++++++++ > 2 files changed, 9 insertions(+) > > diff --git a/backends/hexagon_init.c b/backends/hexagon_init.c > index 9c8c6d8d..1cd27513 100644 > --- a/backends/hexagon_init.c > +++ b/backends/hexagon_init.c > @@ -45,6 +45,7 @@ hexagon_init (Elf *elf __attribute__ ((unused)), > { > hexagon_init_reloc (eh); > HOOK (eh, reloc_simple_type); > + HOOK (eh, machine_flag_check); > > return eh; > } > diff --git a/backends/hexagon_symbol.c b/backends/hexagon_symbol.c > index b341243e..1e681e9f 100644 > --- a/backends/hexagon_symbol.c > +++ b/backends/hexagon_symbol.c > @@ -56,3 +56,11 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__ > ((unused)), int type, > return ELF_T_NUM; > } > } > + > +bool > +hexagon_machine_flag_check (GElf_Word flags) > +{ > + GElf_Word arch_variant = flags &~ EF_HEXAGON_MACH; > + /* 0x8000 covers the "tiny core" arch variants. */ > + return arch_variant == 0 || arch_variant == 0x8000; > +} > -- > 2.37.2 What about this instead? bool hexagon_machine_flag_check(GElf_Word flags) { GElf_Word reserved_flags = ~(EF_HEXAGON_TINY | EF_HEXAGON_MACH); return (flags & reserved_flags) == 0; } ... implies a new EF_HEXAGON_TINY 0x8000 definition BTW.
Hi, On Tue, 2024-04-02 at 21:38 +0000, Brian Cain wrote: > > diff --git a/backends/hexagon_symbol.c b/backends/hexagon_symbol.c > > index b341243e..1e681e9f 100644 > > --- a/backends/hexagon_symbol.c > > +++ b/backends/hexagon_symbol.c > > @@ -56,3 +56,11 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__ > > ((unused)), int type, > > return ELF_T_NUM; > > } > > } > > + > > +bool > > +hexagon_machine_flag_check (GElf_Word flags) > > +{ > > + GElf_Word arch_variant = flags &~ EF_HEXAGON_MACH; > > + /* 0x8000 covers the "tiny core" arch variants. */ > > + return arch_variant == 0 || arch_variant == 0x8000; > > +} > > -- > > 2.37.2 > > What about this instead? > > bool hexagon_machine_flag_check(GElf_Word flags) { > GElf_Word reserved_flags = ~(EF_HEXAGON_TINY | EF_HEXAGON_MACH); > > return (flags & reserved_flags) == 0; > } > > ... implies a new EF_HEXAGON_TINY 0x8000 definition BTW. You obviously know this architecture better than me. But is the TINY flag (bit 15) appropriate for all machines? It looks like it can only be set on V67 and V71. If so maybe just check those two explicitly? Cheers, Mark
> -----Original Message----- > From: Mark Wielaard <mark@klomp.org> > Sent: Thursday, April 4, 2024 11:29 AM > To: Brian Cain <bcain@quicinc.com>; Matheus Bernardino (QUIC) > <quic_mathbern@quicinc.com>; elfutils-devel@sourceware.org > Cc: Sid Manning <sidneym@quicinc.com>; Andrew Pinski (QUIC) > <quic_apinski@quicinc.com> > Subject: Re: [PATCH v2 2/2] Hexagon: implement machine flag check > > WARNING: This email originated from outside of Qualcomm. Please be wary > of any links or attachments, and do not enable macros. > > Hi, > > On Tue, 2024-04-02 at 21:38 +0000, Brian Cain wrote: > > > diff --git a/backends/hexagon_symbol.c b/backends/hexagon_symbol.c > > > index b341243e..1e681e9f 100644 > > > --- a/backends/hexagon_symbol.c > > > +++ b/backends/hexagon_symbol.c > > > @@ -56,3 +56,11 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__ > > > ((unused)), int type, > > > return ELF_T_NUM; > > > } > > > } > > > + > > > +bool > > > +hexagon_machine_flag_check (GElf_Word flags) > > > +{ > > > + GElf_Word arch_variant = flags &~ EF_HEXAGON_MACH; > > > + /* 0x8000 covers the "tiny core" arch variants. */ > > > + return arch_variant == 0 || arch_variant == 0x8000; > > > +} > > > -- > > > 2.37.2 > > > > What about this instead? > > > > bool hexagon_machine_flag_check(GElf_Word flags) { > > GElf_Word reserved_flags = ~(EF_HEXAGON_TINY | > EF_HEXAGON_MACH); > > > > return (flags & reserved_flags) == 0; > > } > > > > ... implies a new EF_HEXAGON_TINY 0x8000 definition BTW. > > You obviously know this architecture better than me. But is the TINY > flag (bit 15) appropriate for all machines? It looks like it can only > be set on V67 and V71. If so maybe just check those two explicitly? So far, V67T and V71T are the only ones with this variation. It could also be specified on yet-to-be-created future devices (some theoretical V99T might exist). What should the behavior be in those cases? -Brian
Hi Brian, On Thu, 2024-04-04 at 16:31 +0000, Brian Cain wrote: > > > ... implies a new EF_HEXAGON_TINY 0x8000 definition BTW. > > > > You obviously know this architecture better than me. But is the TINY > > flag (bit 15) appropriate for all machines? It looks like it can only > > be set on V67 and V71. If so maybe just check those two explicitly? > > So far, V67T and V71T are the only ones with this variation. > It could also be specified on yet-to-be-created future devices > (some theoretical V99T might exist). > What should the behavior be in those cases? OK, if there could be other TINY variants then either the check suggested by Matheus or you would be more correct. I do like the idea to have a self documenting EF_HEXAGON_TINY constant for this. Thanks, Mark
diff --git a/backends/hexagon_init.c b/backends/hexagon_init.c index 9c8c6d8d..1cd27513 100644 --- a/backends/hexagon_init.c +++ b/backends/hexagon_init.c @@ -45,6 +45,7 @@ hexagon_init (Elf *elf __attribute__ ((unused)), { hexagon_init_reloc (eh); HOOK (eh, reloc_simple_type); + HOOK (eh, machine_flag_check); return eh; } diff --git a/backends/hexagon_symbol.c b/backends/hexagon_symbol.c index b341243e..1e681e9f 100644 --- a/backends/hexagon_symbol.c +++ b/backends/hexagon_symbol.c @@ -56,3 +56,11 @@ hexagon_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type, return ELF_T_NUM; } } + +bool +hexagon_machine_flag_check (GElf_Word flags) +{ + GElf_Word arch_variant = flags &~ EF_HEXAGON_MACH; + /* 0x8000 covers the "tiny core" arch variants. */ + return arch_variant == 0 || arch_variant == 0x8000; +}