From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90043.outbound.protection.outlook.com [40.107.9.43]) by sourceware.org (Postfix) with ESMTPS id B1C363858D38 for ; Wed, 12 Aug 2020 16:39:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B1C363858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vz/Xm4N1NaJ4vsQKx/eq0OfkRljMhiSPHMyNqc/M8Ro=; b=qsxqVVvB7qe+Ij2CQcjJ3McaC0z7T3Ab4FCOJiMR0MfIf/jVqz8DP1giBOJ+PNFnbD9r9nIFEd3ekmURgvf06/k5/HDfdTd02zFyqgvBXsSqT17Pj0k8RiXlDN6nnZsVs/amPWq3XDD7sUqQ1wmfkF7pTdSdBRZmX24IVCu4G9s= Received: from DB6PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:6:2d::32) by PR2PR08MB4652.eurprd08.prod.outlook.com (2603:10a6:101:18::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.17; Wed, 12 Aug 2020 16:39:00 +0000 Received: from DB5EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2d:cafe::14) by DB6PR07CA0022.outlook.office365.com (2603:10a6:6:2d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.13 via Frontend Transport; Wed, 12 Aug 2020 16:39:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT053.mail.protection.outlook.com (10.152.21.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Wed, 12 Aug 2020 16:38:59 +0000 Received: ("Tessian outbound a0bffebca527:v64"); Wed, 12 Aug 2020 16:38:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3f38ae2396d19148 X-CR-MTA-TID: 64aa7808 Received: from 544640ac12ea.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1D63D049-A92D-49BC-A71E-BA9096BEC5D1.1; Wed, 12 Aug 2020 16:38:53 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 544640ac12ea.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 12 Aug 2020 16:38:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PhL0RBpHRWOFInKG+mKBu+/S3tiVb/lZ6xrhVCmq+20PmOl4mlp5uEm9EgXMsXf9XWQ7eFhjzc/jK9vN36qhdvbSUwo0vIm6QXCgbWwQ0UYOJxua+URMZ3ufYxdSNTTWDEStPQtOzHa70ILvvXHUuESeYUpx++GT27fYdDnEAXJ3/KyF/8BJf7FEcgJ/ts38iPGa+FH5xLOpozYziTu74RAwVbVDiAUicqX+yggFEpgaHT0Wzq/7XMisSIWh3AAaLij0GiwXg37abSi5svzHmUCPyHrqIHF57fIRAbNJGEALoj4/J1Opc5O1NszVsDpOKvu17Xa37+OawbyAvizsTg== 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-SenderADCheck; bh=Vz/Xm4N1NaJ4vsQKx/eq0OfkRljMhiSPHMyNqc/M8Ro=; b=PJxfGhuWVvKyqv9djXregyXMeknmtPXIYwK/LBWBFfGd406GFF+cvKrsa8S9M24Afny2UGqVzr68zY5pkjiHfzOvf+z1lWCSrxSR2PDm5IDksDxXv76WzdrEJ+UW0Q/Pst3/e90ZLS62aQHaf0d64j55xbsykelmgLpWemrAWDYv/E640eOdcQnsIZSau/7EdHwg4QOYhGe11MNR2AhfuM6nbS46a6ms3m2dOXsdX8dTvUF3hgD6kWP4hKx0IlYygSG5Hs/qZgcGLKO4Jq+mx+WWW6dtRo+MLasHXiMEmlgUEDgzNcROwySrAF6dL3pHvuBMN0FjGkhYK9fxVwXv0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vz/Xm4N1NaJ4vsQKx/eq0OfkRljMhiSPHMyNqc/M8Ro=; b=qsxqVVvB7qe+Ij2CQcjJ3McaC0z7T3Ab4FCOJiMR0MfIf/jVqz8DP1giBOJ+PNFnbD9r9nIFEd3ekmURgvf06/k5/HDfdTd02zFyqgvBXsSqT17Pj0k8RiXlDN6nnZsVs/amPWq3XDD7sUqQ1wmfkF7pTdSdBRZmX24IVCu4G9s= Authentication-Results-Original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM5PR0801MB1682.eurprd08.prod.outlook.com (2603:10a6:203:2e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15; Wed, 12 Aug 2020 16:38:52 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3261.025; Wed, 12 Aug 2020 16:38:52 +0000 Date: Wed, 12 Aug 2020 17:38:45 +0100 From: Szabolcs Nagy To: Alan Modra Cc: binutils@sourceware.org Subject: Re: elf_backend_section_flags and _bfd_elf_init_private_section_data Message-ID: <20200812163844.GR14398@arm.com> References: <20200302010309.GE5384@bubble.grove.modra.org> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200302010309.GE5384@bubble.grove.modra.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: SN6PR01CA0006.prod.exchangelabs.com (2603:10b6:805:b6::19) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by SN6PR01CA0006.prod.exchangelabs.com (2603:10b6:805:b6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Wed, 12 Aug 2020 16:38:50 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e93f3152-f01e-4e85-3e3a-08d83ede369c X-MS-TrafficTypeDiagnostic: AM5PR0801MB1682:|PR2PR08MB4652: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5797;OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(396003)(346002)(366004)(6916009)(6666004)(52116002)(30864003)(7696005)(4326008)(966005)(33656002)(5660300002)(2616005)(66556008)(316002)(8886007)(86362001)(16526019)(2906002)(1076003)(44832011)(186003)(478600001)(8936002)(83380400001)(26005)(66946007)(8676002)(36756003)(956004)(66476007)(55016002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1682 Original-Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT053.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 662d3f55-2115-4e4b-797d-08d83ede3242 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9fgL4qiFwzZr3nc1JsPYzWLXSXyr0eNSJALjdCpsz6LRy1HzAFuOlYSEFO/SRoeu1Pkqlc5Klkd4bFMA7ER6d6Z5BOXCbxwQXJZsUmx7XQ0Num+ay00gibzLEuapDm7TxEkweBoyVnr/sePau32tO+/YnDzQGw0xZxch1zePxFHAlgn2wv3+zElcP+HOP18A4GxBQI8p9SSqv1ixalQhqKF2E6w8ozv88edtpJc3jNkUemPmEbdap5ePf+qadWOxnnzlSFUtlEIrAWfOt+UoO7jrqVLZOJlfuceOSn+cyAabyWPNgRNq8DaSAOhWWzM9crFXNQTfpoiT8O+mOLoj5rgYnuGXAXcBhbAxWhV/7WNB8wy7L5t3CsbVCw/qrAV95creRdmApzlyrRVWKrJhM50YgW4YAHcF9p27Ukb18wgCaX0RIn/gCFg3R5Th12ZOYaQC8PkJHp1VWtZ36ktTqK6Te09oifmGRyNuayO4b2U= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(136003)(346002)(396003)(376002)(46966005)(2906002)(33656002)(478600001)(5660300002)(70586007)(8936002)(336012)(316002)(70206006)(356005)(55016002)(16526019)(83380400001)(186003)(86362001)(6666004)(1076003)(82310400002)(8886007)(47076004)(30864003)(8676002)(966005)(26005)(2616005)(81166007)(36756003)(4326008)(956004)(44832011)(6862004)(7696005)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2020 16:38:59.2726 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e93f3152-f01e-4e85-3e3a-08d83ede369c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT053.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4652 X-Spam-Status: No, score=-15.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Wed, 12 Aug 2020 16:39:09 -0000 The 03/02/2020 11:33, Alan Modra wrote: > I was looking at elf_backend_section_flags as a means of setting > SEC_SMALL_DATA for .sdata, .sbss and the like, and condidered adding > an asection* parameter to access the section name easily before > realising that hdr->bfd_section of course makes the section > available. So no new parameter needed. In fact the flagword* > parameter isn't needed either, so out it goes. > > The patch also tidies some horrible code in _bfd_elf_new_section_hook > that can change whether known ABI sections have sh_type and sh_flags > set up depending on which of the bfd_make_section functions is used. > (Some of those set section flags before _bfd_elf_new_section_hook is > called, others leave the flags zero.) The function also had some > hacks for .init_array and .fini_array to affect how > _bfd_elf_init_private_section_data behaved for those sections. It's > cleaner to do that in _bfd_elf_init_private_section_data. So that all > goes and we now init sh_type and sh_flags for all known ABI sections > in _bfd_elf_new_section_hook. _bfd_elf_init_private_section_data is > changed to suit, and now doesn't just single out SHT_INIT_ARRAY and > SHT_FINI_ARRAY but rather any of the special section types. > > The _bfd_elf_new_section_hook change resulting in > +FAIL: ld-aarch64/erratum835769-843419 > exposing some errors in the aarch64 backend. elfNN_aarch64_size_stubs > should not be looking at linker created sections in the stub bfd. Nor > should code like "symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr" be > run without first checking that input_bfd is ELF. i'm looking at a 2.35 ld regression that affects the aarch64 linux kernel and this commit might have caused it. opened https://sourceware.org/bugzilla/show_bug.cgi?id=26378 > > * elf-bfd.h (elf_backend_section_flags): Remove flagword* param. > * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before > calling elf_backend_section_flags with adjusted params. Use > newsect->flags past that point. > (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for > special sections. > (_bfd_elf_init_private_section_data): Allow normal sh_type sections > to have their type overridden, and all sh_flags but processor and > os specific. > * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params. > * elf32-mep.c (mep_elf_section_flags): Likewise. > * elf32-nios2.c (nios2_elf32_section_flags): Likewise. > * elf64-alpha.c (elf64_alpha_section_flags): Likewise. > * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise. > * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise. > * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker > stub BFD and non-aarch64 input files when scanning for stubs. > > diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h > index b930761363..61e733f068 100644 > --- a/bfd/elf-bfd.h > +++ b/bfd/elf-bfd.h > @@ -955,7 +955,7 @@ struct elf_backend_data > /* A function to convert machine dependent ELF section header flags to > BFD internal section header flags. */ > bfd_boolean (*elf_backend_section_flags) > - (flagword *, const Elf_Internal_Shdr *); > + (const Elf_Internal_Shdr *); > > /* A function that returns a struct containing ELF section flags and > type for the given BFD section. */ > diff --git a/bfd/elf.c b/bfd/elf.c > index 265fc87ad5..fcd84d2d17 100644 > --- a/bfd/elf.c > +++ b/bfd/elf.c > @@ -1114,14 +1114,14 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, > && elf_next_in_group (newsect) == NULL) > flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; > > + if (!bfd_set_section_flags (newsect, flags)) > + return FALSE; > + > bed = get_elf_backend_data (abfd); > if (bed->elf_backend_section_flags) > - if (! bed->elf_backend_section_flags (&flags, hdr)) > + if (!bed->elf_backend_section_flags (hdr)) > return FALSE; > > - if (!bfd_set_section_flags (newsect, flags)) > - return FALSE; > - > /* We do not parse the PT_NOTE segments as we are interested even in the > separate debug info files which may have the segments offsets corrupted. > PT_NOTEs from the core files are currently not parsed using BFD. */ > @@ -1137,7 +1137,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, > free (contents); > } > > - if ((flags & SEC_ALLOC) != 0) > + if ((newsect->flags & SEC_ALLOC) != 0) > { > Elf_Internal_Phdr *phdr; > unsigned int i, nload; > @@ -1163,7 +1163,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, > || phdr->p_type == PT_TLS) > && ELF_SECTION_IN_SEGMENT (hdr, phdr)) > { > - if ((flags & SEC_LOAD) == 0) > + if ((newsect->flags & SEC_LOAD) == 0) > newsect->lma = (phdr->p_paddr > + hdr->sh_addr - phdr->p_vaddr); > else > @@ -1191,7 +1191,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, > > /* Compress/decompress DWARF debug sections with names: .debug_* and > .zdebug_*, after the section flags is set. */ > - if ((flags & SEC_DEBUGGING) > + if ((newsect->flags & SEC_DEBUGGING) > && ((name[1] == 'd' && name[6] == '_') > || (name[1] == 'z' && name[7] == '_'))) > { > @@ -2900,28 +2900,13 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) > bed = get_elf_backend_data (abfd); > sec->use_rela_p = bed->default_use_rela_p; > > - /* When we read a file, we don't need to set ELF section type and > - flags. They will be overridden in _bfd_elf_make_section_from_shdr > - anyway. We will set ELF section type and flags for all linker > - created sections. If user specifies BFD section flags, we will > - set ELF section type and flags based on BFD section flags in > - elf_fake_sections. Special handling for .init_array/.fini_array > - output sections since they may contain .ctors/.dtors input > - sections. We don't want _bfd_elf_init_private_section_data to > - copy ELF section type from .ctors/.dtors input sections. */ > - if (abfd->direction != read_direction > - || (sec->flags & SEC_LINKER_CREATED) != 0) > + /* Set up ELF section type and flags for newly created sections, if > + there is an ABI mandated section. */ > + ssect = (*bed->get_sec_type_attr) (abfd, sec); > + if (ssect != NULL) > { > - ssect = (*bed->get_sec_type_attr) (abfd, sec); > - if (ssect != NULL > - && (!sec->flags > - || (sec->flags & SEC_LINKER_CREATED) != 0 > - || ssect->type == SHT_INIT_ARRAY > - || ssect->type == SHT_FINI_ARRAY)) > - { > - elf_section_type (sec) = ssect->type; > - elf_section_flags (sec) = ssect->attr; > - } > + elf_section_type (sec) = ssect->type; > + elf_section_flags (sec) = ssect->attr; > } > > return _bfd_generic_new_section_hook (abfd, sec); > @@ -7757,10 +7742,19 @@ _bfd_elf_init_private_section_data (bfd *ibfd, > > BFD_ASSERT (elf_section_data (osec) != NULL); > > - /* For objcopy and relocatable link, don't copy the output ELF > - section type from input if the output BFD section flags have been > - set to something different. For a final link allow some flags > - that the linker clears to differ. */ > + /* If this is a known ABI section, ELF section type and flags may > + have been set up when OSEC was created. For normal sections we > + allow the user to override the type and flags other than > + SHF_MASKOS and SHF_MASKPROC. */ > + if (elf_section_type (osec) == SHT_PROGBITS > + || elf_section_type (osec) == SHT_NOTE > + || elf_section_type (osec) == SHT_NOBITS) > + elf_section_type (osec) = SHT_NULL; > + /* For objcopy and relocatable link, copy the ELF section type from > + the input file if the BFD section flags are the same. (If they > + are different the user may be doing something like > + "objcopy --set-section-flags .text=alloc,data".) For a final > + link allow some flags that the linker clears to differ. */ > if (elf_section_type (osec) == SHT_NULL > && (osec->flags == isec->flags > || (final_link > @@ -7769,8 +7763,8 @@ _bfd_elf_init_private_section_data (bfd *ibfd, > elf_section_type (osec) = elf_section_type (isec); > > /* FIXME: Is this correct for all OS/PROC specific flags? */ > - elf_section_flags (osec) |= (elf_section_flags (isec) > - & (SHF_MASKOS | SHF_MASKPROC)); > + elf_section_flags (osec) = (elf_section_flags (isec) > + & (SHF_MASKOS | SHF_MASKPROC)); > > /* Copy sh_info from input for mbind section. */ > if ((elf_tdata (ibfd)->has_gnu_osabi & elf_gnu_osabi_mbind) != 0 > diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c > index e9d93cc3b8..c899aeb8f6 100644 > --- a/bfd/elf32-arm.c > +++ b/bfd/elf32-arm.c > @@ -20230,10 +20230,10 @@ elf32_arm_get_synthetic_symtab (bfd *abfd, > } > > static bfd_boolean > -elf32_arm_section_flags (flagword *flags, const Elf_Internal_Shdr * hdr) > +elf32_arm_section_flags (const Elf_Internal_Shdr *hdr) > { > if (hdr->sh_flags & SHF_ARM_PURECODE) > - *flags |= SEC_ELF_PURECODE; > + hdr->bfd_section->flags |= SEC_ELF_PURECODE; > return TRUE; > } > > diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c > index 14a6d22621..c5775de649 100644 > --- a/bfd/elf32-mep.c > +++ b/bfd/elf32-mep.c > @@ -717,10 +717,10 @@ mep_elf_object_p (bfd * abfd) > } > > static bfd_boolean > -mep_elf_section_flags (flagword * flags, const Elf_Internal_Shdr * hdr) > +mep_elf_section_flags (const Elf_Internal_Shdr *hdr) > { > if (hdr->sh_flags & SHF_MEP_VLIW) > - * flags |= SEC_MEP_VLIW; > + hdr->bfd_section->flags |= SEC_MEP_VLIW; > return TRUE; > } > > diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c > index 17e97bca5a..2fcfe6fd6c 100644 > --- a/bfd/elf32-nios2.c > +++ b/bfd/elf32-nios2.c > @@ -4539,10 +4539,10 @@ nios2_elf32_relocate_section (bfd *output_bfd, > /* Implement elf-backend_section_flags: > Convert NIOS2 specific section flags to bfd internal section flags. */ > static bfd_boolean > -nios2_elf32_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr) > +nios2_elf32_section_flags (const Elf_Internal_Shdr *hdr) > { > if (hdr->sh_flags & SHF_NIOS2_GPREL) > - *flags |= SEC_SMALL_DATA; > + hdr->bfd_section->flags |= SEC_SMALL_DATA; > > return TRUE; > } > diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c > index ed18202b71..9d2d7f1d4d 100644 > --- a/bfd/elf64-alpha.c > +++ b/bfd/elf64-alpha.c > @@ -1180,10 +1180,10 @@ elf64_alpha_section_from_shdr (bfd *abfd, > /* Convert Alpha specific section flags to bfd internal section flags. */ > > static bfd_boolean > -elf64_alpha_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr) > +elf64_alpha_section_flags (const Elf_Internal_Shdr *hdr) > { > if (hdr->sh_flags & SHF_ALPHA_GPREL) > - *flags |= SEC_SMALL_DATA; > + hdr->bfd_section->flags |= SEC_SMALL_DATA; > > return TRUE; > } > diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c > index 636d7897ee..d40fa4277a 100644 > --- a/bfd/elf64-ia64-vms.c > +++ b/bfd/elf64-ia64-vms.c > @@ -822,11 +822,10 @@ is_unwind_section_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) > flag. */ > > static bfd_boolean > -elf64_ia64_section_flags (flagword *flags, > - const Elf_Internal_Shdr *hdr) > +elf64_ia64_section_flags (const Elf_Internal_Shdr *hdr) > { > if (hdr->sh_flags & SHF_IA_64_SHORT) > - *flags |= SEC_SMALL_DATA; > + hdr->bfd_section->flags |= SEC_SMALL_DATA; > > return TRUE; > } > diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c > index 35dd8ab167..ba3ad45468 100644 > --- a/bfd/elfnn-aarch64.c > +++ b/bfd/elfnn-aarch64.c > @@ -4313,9 +4313,15 @@ elfNN_aarch64_size_stubs (bfd *output_bfd, > > for (input_bfd = info->input_bfds; > input_bfd != NULL; input_bfd = input_bfd->link.next) > - if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info, > - &num_erratum_835769_fixes)) > - return FALSE; > + { > + if (!is_aarch64_elf (input_bfd) > + || (input_bfd->flags & BFD_LINKER_CREATED) != 0) > + continue; > + > + if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info, > + &num_erratum_835769_fixes)) > + return FALSE; > + } > > _bfd_aarch64_resize_stubs (htab); > (*htab->layout_sections_again) (); > @@ -4331,6 +4337,10 @@ elfNN_aarch64_size_stubs (bfd *output_bfd, > { > asection *section; > > + if (!is_aarch64_elf (input_bfd) > + || (input_bfd->flags & BFD_LINKER_CREATED) != 0) > + continue; > + > for (section = input_bfd->sections; > section != NULL; > section = section->next) > @@ -4353,6 +4363,10 @@ elfNN_aarch64_size_stubs (bfd *output_bfd, > asection *section; > Elf_Internal_Sym *local_syms = NULL; > > + if (!is_aarch64_elf (input_bfd) > + || (input_bfd->flags & BFD_LINKER_CREATED) != 0) > + continue; > + > /* We'll need the symbol table in a second. */ > symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; > if (symtab_hdr->sh_info == 0) > diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c > index 1df2aa842c..208b85df90 100644 > --- a/bfd/elfnn-ia64.c > +++ b/bfd/elfnn-ia64.c > @@ -942,11 +942,10 @@ elfNN_ia64_section_from_shdr (bfd *abfd, > flag. */ > > static bfd_boolean > -elfNN_ia64_section_flags (flagword *flags, > - const Elf_Internal_Shdr *hdr) > +elfNN_ia64_section_flags (const Elf_Internal_Shdr *hdr) > { > if (hdr->sh_flags & SHF_IA_64_SHORT) > - *flags |= SEC_SMALL_DATA; > + hdr->bfd_section->flags |= SEC_SMALL_DATA; > > return TRUE; > } > > -- > Alan Modra > Australia Development Lab, IBM --