From patchwork Mon Aug 14 13:48:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 135438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2757269vqi; Mon, 14 Aug 2023 06:48:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGB664RkoX4gek3nRMmPtYTxnuTrdcKva1FzfsjbV3oyRVtVHazX4FLaqWhNZhVGYN5iwEZ X-Received: by 2002:a17:907:761b:b0:992:3897:1985 with SMTP id jx27-20020a170907761b00b0099238971985mr7707476ejc.43.1692020934838; Mon, 14 Aug 2023 06:48:54 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dv10-20020a170906b80a00b009930f844671si8256472ejb.963.2023.08.14.06.48.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 06:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.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=@sourceware.org header.s=default header.b=mb5iyDaR; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE7B53857019 for ; Mon, 14 Aug 2023 13:48:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE7B53857019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692020921; bh=hBzvo+1kuHh+TIAPq29+xM3sQksDaCvG8zbe+BRoi/0=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mb5iyDaRiJX+DeY/l/ceVqS2ocDkEI24O1SqqRkgNGQQ/HXSgOdHGcSaSPe2VG+MX lTCbs+NI35Ee4U10mQb8INgbtR73pU1Bkb6Q0OEaYW14SkFugIVhdwj5Wy7Hdh8zXL CecW7QD8Wxv20tppbMeGhacBOILyoBjmgJ+9Zpz0= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2042.outbound.protection.outlook.com [40.107.13.42]) by sourceware.org (Postfix) with ESMTPS id 7B22A3858C3A for ; Mon, 14 Aug 2023 13:48:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B22A3858C3A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cFhDOGLsCgMnrPBDK7CcRMZKtdj5+4MZ7uMPy/h+mf2Pw4/buSwNZcICuhx6wkAoOHsBmM2mX287xO475QEGU/VbCdB67YFQq1yFSlJtA6M7bZZ/FQ7G4bdTfJ6HKsZvMfIxXXmZKQgYOoSCLf1GoeIN6CM+7DrV5u3dTXKRlYff7RQpWbSFLWOQrgo/JGwD1zHne8uT0c1PJlxSWIdZPMA7V0FEh5DHPSTcalleX116ah384AQOgBybZ72T7MWaxWN1XGYu4IeD/fI4ovBVLREQrqH+5iaZ+Ih9EmGvm0XUrDWZsyD9A1mJjU1RRemE+8nw75Q+ld77iCRUjILgYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hBzvo+1kuHh+TIAPq29+xM3sQksDaCvG8zbe+BRoi/0=; b=Q4jeI4Vw7wY5pRzrVml09ZQMCshscL3T4EB3/NfBzBdtg63Njq9R/5doNWudXRThJx5UCU368Y9z/1Olgq0+/ZM+j8uySm8Nnm2oR1owDVImrBHPQW3Y36t+Wnjrz9hTaBj/pQuRArAeW7ntjEXQS+eeJLNHMXpJA1BanvrSpGCiDgpraetThLgrPjZWCHHVkjxNwsIA3JyaudJFM9fQyLsSpnLKqNMI615fMy9aBEKwWfGdlPgap34BbJ+0W+qdjsCa44+AWDbKNNhiGnDCq8/sRJDnld71if246g+4+2Je0BgMlRDYygg+L5kavUCTq9WqzoPRflEy5ZlDnG/hMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AM7PR04MB7109.eurprd04.prod.outlook.com (2603:10a6:20b:117::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 13:48:23 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::79a:54ba:8003:fbe7]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::79a:54ba:8003:fbe7%6]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 13:48:23 +0000 Message-ID: <61c83a56-fe09-1c86-32d0-25535dd7e96f@suse.com> Date: Mon, 14 Aug 2023 15:48:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: [PATCH 1/2] gas/ELF: allow "inheriting" section attributes and type Content-Language: en-US To: Binutils Cc: Nick Clifton , Alan Modra References: <9ccf6770-66bd-c924-93e1-fd54a6daf610@suse.com> In-Reply-To: <9ccf6770-66bd-c924-93e1-fd54a6daf610@suse.com> X-ClientProxiedBy: FR3P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::23) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AM7PR04MB7109:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c93439d-3b7a-4d2b-319c-08db9ccd2083 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHXw/kfnZozqlHu9IipyG2sm488tQ/Zbk45lxlX+DvVZIbetEqZXqP5J7D1g7MoWNRBauqQBV1c3/a1G4d4JF+ypq25HDQii4TyW1P8ET+RmguJf8pRz0hR96Rzl//dJzLCnYZwq7/dvcxQWFHFjCUVNHl9f5c6b9iQOZZJBmveT94TNTTQrIa+ocDy5YsKke5MA+KTD1Aw3ZUcz/CdgTQUY/GhczB/CO8rQER/Bczy+lFwaYRmrtelv0y8O8Remj1dL/o+I0snh4wlv0AZq/XsIKXuz+cJOulC3zoOr1bgZcStFVUgqhtUFcaCXF9FoBK4usyB6oHovnpG0mEVAwrnmEfy2vd2V/nOwyg3h1MyR8OK8PKZ28tGRT5gZTvpXCwjP9QJvovvZIezhGaVqGMV/R/w8zzxlfNq/YAhuHBxHWi55QaPjrO/Opk56I86hemxZfpasiFntfVKXw7HAsyz8qQ9hUhrEBpCG4RwnYVBOUrcHj6WM+73pC+Q5zfcE0i4aAhs3aCT79be5GgWyBylbuBtFbCJ03e2ce2NSRblaW8gbEXoyEX6yDStM5l06zhyqjkNvDoPgMDJuSjfXgFeM1W0LLL54+x9ix2Y/FqrBpPU1IcrHbzkymFLqxes9QpUjQDdLcvcsmXnQL37bIQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8790.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39850400004)(346002)(136003)(396003)(376002)(366004)(1800799006)(186006)(451199021)(26005)(6506007)(41300700001)(8936002)(66476007)(66556008)(66946007)(316002)(8676002)(6512007)(31686004)(2616005)(83380400001)(6486002)(478600001)(38100700002)(54906003)(31696002)(36756003)(86362001)(4326008)(6916009)(5660300002)(2906002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?73fmEByxoe6fCLGk/KGjBLKrM2Uu?= =?utf-8?q?JoLPtVxf1edBHNIPP8MA03vfk5gSb/rU2hYTWXCRgqmH/DaGSQ6xPpzLOMP+gPcqi?= =?utf-8?q?G3tZl2cjLi4jraCVGQZfFhnXJU+MxblhR7X+2E3G/FY2hC+akmzPi126YRqk+tB0b?= =?utf-8?q?vUoX4SXjtPp0JIWxa5IGMjCtVVmdZOqZu/8+BS+b8d97Wane9ID+zrkgLn1tj/zYe?= =?utf-8?q?/V2uie3zN2BRHAUOY83xeynNZh5UjK5est2RypVRYmV8ouZC34J1MwOsh0aE1z/ux?= =?utf-8?q?OZM3eDT3IpYl3zYBu0BVbgGsbF2U8kE92u2staTb6R2yZrg1I/o6rq9RjbQvRLN6v?= =?utf-8?q?l66Z+0d0wiw5/YDc5vppjfkT2OZYZm9WZHmCF+Boq++0DBWLOcqLuwq3QBuSWhCje?= =?utf-8?q?xfioKNJO3xTqdYXXl4TKVg/KoClG2ARgA3JFfztw6PfKRo+08oUdRyU/g6akjHJ2j?= =?utf-8?q?XcrhH1DVW2SNP+ESKGfQEo383/jEoOe0xGhzwlROpThTCusGBXtriINoUru8cfaI7?= =?utf-8?q?ZS2IMcQzyatrislkeMtCkGbyiwuqRVOXrehZ4VzcU6GNim3/AxjuKkuDKuZ7kmb8X?= =?utf-8?q?0Jo6ZMzfSpdieQKoefBfH05C/ymcM7fyEkwqTBF/2+uFSruf7uc5/c4UO44qLMu8q?= =?utf-8?q?ZdGGfGQuxNdxJ1ZdWy7xH3WiUr2nasBWF82dwJXEn5BUOrX8xZeWIvlBYC8B/CQI6?= =?utf-8?q?0Fn8NoHNP2juip2tzedflsUIwdsGp3vHPb01QLKopYzKVEAIHV3LVvPkcRQe5n+Sw?= =?utf-8?q?5vgyd4irj5PbE5DHIi8FRntrKXvsNuim6LY/50JzfEsNr0RGbJrHqdlJNW5ahiZsW?= =?utf-8?q?1PTgtreFpjdqJYUoj6MWE66tdjPje4GNcAzO7vcFRanthBYGsT7LwS9wgxSCGJpuW?= =?utf-8?q?9d3fB/JzUmzTQgSnS4A3Cjn/NiedvhZsfBL0n2WwPNccQJo4C8RVew5bpUa0tCJSr?= =?utf-8?q?1izyUu4p/kWUTC0XjgwGbYyTO4k5zJ0GNvlV6KmjgfND12x5qdcpzFmLnZ34JM32T?= =?utf-8?q?BE+qVAK6Kp31+N+hNGXZEbawDEHMvolCfBppfG4OtaYvLopsz+LYvfo6zk/wqoxF/?= =?utf-8?q?9MezRRty68UIva7cTXXv5usZDXcydnzrEi8/rE7aQijGX3sZuLsjr1UeMbuDY/h+U?= =?utf-8?q?BcwKRHS8hBg0lNXV6AEPvts57lrZnYFjqNKb1cERSMjdWnFjdwwQ6DE67XmE9Ahi4?= =?utf-8?q?P5M/K/MkYK9NsicKoF6MFZCT8C5GnjJ52Y3dVD2VJmRS4wmmbvWaF8AiKqMjVvNjp?= =?utf-8?q?oZkjcUPmjrWe/aFfnYAAXZSgLFx5rVFrZ0BgCo0KYjPjay6a6rz8rpFNbWzvJ5U+O?= =?utf-8?q?IYzGAOs11CvtTYnRlLmtog2WHCYj7dTfrN0CdK8JlwkHCz32X8YPuzLGthmCL/hfw?= =?utf-8?q?wpEMqe5qU/+Y/aDXi5rkVfsxgHiV9MHDzU99aPPYqTsyBgK16VZWyONEkRg7sOQmp?= =?utf-8?q?CJrZRI4haQt5cC2m3j7PTa67eNytuC6XHkKDfIdGM0jTJzIbU8Poa/7XVqKhKUyLy?= =?utf-8?q?PnhG7vjOk2D3?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c93439d-3b7a-4d2b-319c-08db9ccd2083 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 13:48:23.1515 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fjvbCQEyVow12uoSBicqKAE6CtBGt4xNfvTDuPc1jJ1oS1YjJQiOsYpFjYhQnpOS+sKbjsoIAsOcHSf1AgcsYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7109 X-Spam-Status: No, score=-3027.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774212468127373297 X-GMAIL-MSGID: 1774212544006597249 While --sectname-subst is nice, it isn't enough to e.g. mimic -f{function,data}-sections in assembly code, when such use is to be optional (e.g. dependent upon some configuration setting). Assign meaning to '+' and '-' as section attribute letters, allowing to inherit the prior section's attributes (and possibly type) along with adding or removing some. Note that documenting the interaction with '?' as undefined is a precautionary measure. While touching the function invocation, stop using |= on the result of obj_elf_parse_section_letters(): "attr" is firmly zero ahead of the call. --- The change ends up much simpler than I expected, and hence I fear it's overly simplistic (i.e. I'm overlooking something that would break). In any event the optional settings beyond the group are becoming hard to handle: For SHF_GNU_MBIND it is not an error when no corresponding number follows. So it may be necessary to simply document restrictions, or to refuse to accept anything past the group. Of course it is also an option to allow nothing past (e.g.) type when inheriting is used. I didn't extend obj_elf_parse_section_letters()'es bad_msg: It's missing a number of other characters already. And if doing so, a couple of config/tc-*.c would also need adjustment. Perhaps this could do with an overhaul anyway, having the target hook pass back merely the extra letters it understands, with common code then synthesizing a message. Initially I considered tying the functionality to --sectname-subst's, which made me look at users of obj_elf_section_name(). How come obj_elf_attach_to_group() and group name handling in obj_elf_section() use that function? The names there are symbol names, not section ones, aiui (in fact when using section names, the names are lost, as section symbols are emitted without names), and at least in the former case it also looks bogus to allow name substitution there (because of then deriving the name from that of the section itself, rather than some other one). --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -6818,6 +6818,12 @@ section is a member of a section group section is used for thread-local-storage @item ? section is a member of the previously-current section's group, if any +@item + +section inherits attributes and (unless explicitly specified) type from the +previously-current section, adding other attributes as specified +@item - +section inherits attributes and (unless explicitly specified) type from the +previously-current section, removing other attributes as specified @item R retained section (apply SHF_GNU_RETAIN to prevent linker garbage collection, GNU ELF extension) @@ -6839,6 +6845,12 @@ section may have the executable (@code{x @code{.attach_to_group} directive can be used to add a section to a group even if the section was not originally declared to be part of that group. +Note further that @code{+} and @code{-} need to come first and can only take +the effect described here unless overridden by a target. The attributes +inherited are those in effect at the time the directive is processed. +Attributes added later (see above) will not be inherited. Using either +together with @code{?} is undefined at this point. + The optional @var{type} argument may contain one of the following constants: @table @code --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -822,10 +822,12 @@ obj_elf_change_section (const char *name static bfd_vma obj_elf_parse_section_letters (char *str, size_t len, - bool *is_clone, bfd_vma *gnu_attr) + bool *is_clone, int *inherit, bfd_vma *gnu_attr) { bfd_vma attr = 0; + *is_clone = false; + *inherit = 0; while (len > 0) { @@ -923,6 +925,8 @@ obj_elf_parse_section_letters (char *str len -= (end - str); str = end; } + else if (!attr && !*gnu_attr && (*str == '+' || *str == '-')) + *inherit = *str == '+' ? 1 : -1; else as_fatal ("%s", bad_msg); } @@ -1171,6 +1175,7 @@ obj_elf_section (int push) if (*input_line_pointer == '"') { bool is_clone; + int inherit; beg = demand_copy_C_string (&dummy); if (beg == NULL) @@ -1178,8 +1183,15 @@ obj_elf_section (int push) ignore_rest_of_line (); return; } - attr |= obj_elf_parse_section_letters (beg, strlen (beg), - &is_clone, &gnu_attr); + attr = obj_elf_parse_section_letters (beg, strlen (beg), &is_clone, + &inherit, &gnu_attr); + + if (inherit > 0) + attr |= elf_section_flags (now_seg); + else if (inherit < 0) + attr = elf_section_flags (now_seg) & ~attr; + if (inherit) + type = elf_section_type (now_seg); SKIP_WHITESPACE (); if (*input_line_pointer == ',') @@ -1224,6 +1236,9 @@ obj_elf_section (int push) { ++input_line_pointer; SKIP_WHITESPACE (); + if (inherit && *input_line_pointer == ',' + && (bfd_section_flags (now_seg) & SEC_MERGE) != 0) + goto fetch_entsize; entsize = get_absolute_expression (); SKIP_WHITESPACE (); if (entsize < 0) @@ -1233,6 +1248,12 @@ obj_elf_section (int push) entsize = 0; } } + else if ((attr & SHF_MERGE) != 0 && inherit + && (bfd_section_flags (now_seg) & SEC_MERGE) != 0) + { + fetch_entsize: + entsize = now_seg->entsize; + } else if ((attr & SHF_MERGE) != 0) { as_warn (_("entity size for SHF_MERGE not specified")); @@ -1248,6 +1269,9 @@ obj_elf_section (int push) { linked_to_section_index = strtoul (input_line_pointer, & input_line_pointer, 0); } + else if (inherit && *input_line_pointer == ',' + && (elf_section_flags (now_seg) & SHF_LINK_ORDER) != 0) + goto fetch_linked_to; else { char c; @@ -1260,6 +1284,17 @@ obj_elf_section (int push) match.linked_to_symbol_name = xmemdup0 (beg, length); } } + else if ((attr & SHF_LINK_ORDER) != 0 && inherit + && (elf_section_flags (now_seg) & SHF_LINK_ORDER) != 0) + { + fetch_linked_to: + if (now_seg->map_head.linked_to_symbol_name) + match.linked_to_symbol_name = + now_seg->map_head.linked_to_symbol_name; + else + linked_to_section_index = + elf_section_data (now_seg)->this_hdr.sh_link; + } if ((attr & SHF_GROUP) != 0 && is_clone) { @@ -1270,6 +1305,10 @@ obj_elf_section (int push) if ((attr & SHF_GROUP) != 0 && *input_line_pointer == ',') { ++input_line_pointer; + SKIP_WHITESPACE (); + if (inherit && *input_line_pointer == ',' + && (elf_section_flags (now_seg) & SHF_GROUP) != 0) + goto fetch_group; match.group_name = obj_elf_section_name (); if (match.group_name == NULL) attr &= ~SHF_GROUP; @@ -1286,6 +1325,14 @@ obj_elf_section (int push) else if (startswith (name, ".gnu.linkonce")) linkonce = 1; } + else if ((attr & SHF_GROUP) != 0 && inherit + && (elf_section_flags (now_seg) & SHF_GROUP) != 0) + { + fetch_group: + match.group_name = elf_group_name (now_seg); + linkonce = + (bfd_section_flags (now_seg) & SEC_LINK_ONCE) != 0; + } else if ((attr & SHF_GROUP) != 0) { as_warn (_("group name for SHF_GROUP not specified")); --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -279,6 +279,11 @@ if { [is_elf_format] } then { run_dump_test "section27" run_dump_test "section28" run_dump_test "section29" + if { ![istarget "rx-*-*"] } then { + run_dump_test "section30" + } else { + run_dump_test "section30" {{as -muse-conventional-section-names}} + } run_dump_test "sh-link-zero" run_dump_test "size" run_dump_test "dwarf2-1" $dump_opts --- /dev/null +++ b/gas/testsuite/gas/elf/section30.d @@ -0,0 +1,28 @@ +#as: --sectname-subst +#readelf: -SW +#name: --sectname-subst plus section attr/type inherting +# Targets setting NO_PSEUDO_DOT don't allow macros of certain names. +#notarget: m681*-*-* m68hc1*-*-* s12z-*-* spu-*-* xgate-*-* z80-*-* + +#... + \[..\] \.group +GROUP +[0-9a-f]+ [0-9a-f]+ 0+c 04 +[1-9][0-9]* +[1-9][0-9]* +4 + \[..\] \.text +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+0 00 AX 0 0 +[1-9][0-9]* + \[..\] \.data +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+0 00 WA 0 0 +[1-9][0-9]* + \[..\] \.bss +NOBITS +[0-9a-f]+ [0-9a-f]+ 0+0 00 WA 0 0 +[1-9][0-9]* +#... + \[..\] \.text\.func1 +PROGBITS +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 AX 0 0 +[1-9][0-9]* + \[..\] \.text\.func2 +PROGBITS +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 00 AX 0 0 +[1-9][0-9]* + \[..\] \.data\.data1 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+1 00 WA 0 0 1 +#... + \[..\] \.bss\.data2 +NOBITS +[0-9a-f]+ [0-9a-f]+ 0+2 00 WA 0 0 1 + \[..\] \.rodata +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+0 00 A 0 0 1 + \[..\] \.rodata\.data3 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+3 00 A 0 0 1 + \[..\] \.rodata\.str1\.1 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+0 01 AMS 0 0 1 + \[..\] \.rodata\.str1\.1\.str1 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+8 01 AMS 0 0 1 + \[..\] \.rodata\.2 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+0 00 AL [1-9] 0 1 + \[..\] \.rodata\.2\.data4 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+4 00 AL [1-9] 0 1 + \[..\] \.bss\.data5 +NOBITS +[0-9a-f]+ [0-9a-f]+ 0+5 00 WA 0 0 1 + \[..\] \.rodata\.3 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+0 00 AG 0 0 1 + \[..\] \.rodata\.3\.data6 +PROGBITS +[0-9a-f]+ [0-9a-f]+ 0+6 00 AG 0 0 1 + \[..\] \.bss\.data7 +NOBITS +[0-9a-f]+ [0-9a-f]+ 0+7 00 WA 0 0 1 +#pass --- /dev/null +++ b/gas/testsuite/gas/elf/section30.s @@ -0,0 +1,67 @@ + .macro func name:req + .pushsection %S.\name, "+" + .type \name, %function + .global \name + .hidden \name +\name: + .endm + + .macro data name:req + .pushsection %S.\name, "+" + .type \name, %object +\name: + .endm + + .macro end name:req + .size \name, . - \name + .popsection + .endm + + + .text + func func1 + .nop + end func1 + + func func2 + .nop + .nop + end func2 + + .data + data data1 + .byte 1 + end data1 + + .section .bss + data data2 + .skip 2 + end data2 + + .section .rodata, "a", %progbits + data data3 + .byte 3, 3, 3 + end data3 + + .section .rodata.str1.1, "aMS", %progbits, 1 + data str1 + .asciz "string1" + end str1 + + .section .rodata.2, "ao", %progbits, func1 + data data4 + .byte 4, 4, 4, 4 + end data4 + .pushsection .bss.data5, "-o", %nobits + .type data5, %object +data5: .fill 5 + end data5 + + .section .rodata.3, "aG", %progbits, sig1, comdat + data data6 + .byte 6, 6, 6, 6, 6, 6 + end data6 + .pushsection .bss.data7, "-G", %nobits + .type data7, %object +data7: .skip 7 + end data7