From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by sourceware.org (Postfix) with ESMTPS id 66688386F464 for ; Fri, 2 Oct 2020 12:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 66688386F464 Received: by mail-ot1-x342.google.com with SMTP id 60so1203176otw.3 for ; Fri, 02 Oct 2020 05:41:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=alXy8wxddM4aPUfo8EZKOAJKwT0P5v9W/1ssxeJKc7E=; b=NTyjBAy4hh7rsGxNn9CXYLaYBkJ9b6tsVFrZiNi00FRSLakAjktXfxu/dBCX0mni9V 3SE9/HLWTnmaVaYgTrlD46jt4U9Yq3Y271fOXLCgP+gNL5zaucYKac2EExdLKKMNjx2j vSVWAOGLl+hEN7dKlSpdO4dUoOMO7j3pVAiQUmx4cQW3RYHEHjzgReDbFo2gsAJG9T+2 2PL5OjjonhTGf2qATyA9ivd/EodYg9W4XJ6rmO3VoumKGWEIf8/s7962RTLbHOowNM/J w4BmolcYrApS4vsieC1CnOp9V4vRdoOaKff7oNfAKgjhajErQ/q2DXH1nVvkfJIdiqtO 6P1Q== X-Gm-Message-State: AOAM530/P2m1OSwITZiWebxK+zMxlfER2HnFzsE7YsC8WbeLKXp5x2uP oE9cbYQ931gW4M9p00ARy0nRjFpb1P/+DLcX2YM= X-Google-Smtp-Source: ABdhPJx5PWuzFCJyLtJlTlvIVPidj8HXB4S2XtJWpzp11Tzca63/H/k6Wsg8txVXLM9wcPvSmDaAdKfgCJuJ/VQTagk= X-Received: by 2002:a9d:5545:: with SMTP id h5mr1459980oti.269.1601642509855; Fri, 02 Oct 2020 05:41:49 -0700 (PDT) MIME-Version: 1.0 References: <20200928132613.btkqaoomv4fdnupn@jozef-acer-manjaro> <20201001105033.4eniyhry5o6epu4x@jozef-acer-manjaro> <20201001113907.GK15011@bubble.grove.modra.org> <20201002123023.xr7fnqmuuq6xd7xh@jozef-acer-manjaro> In-Reply-To: From: "H.J. Lu" Date: Fri, 2 Oct 2020 05:41:13 -0700 Message-ID: Subject: Re: [PATCH v2] Support for SHF_GNU_RETAIN ELF Section Flag To: Alan Modra Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3031.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: Fri, 02 Oct 2020 12:41:51 -0000 On Fri, Oct 2, 2020 at 5:33 AM H.J. Lu wrote: > > On Fri, Oct 2, 2020 at 5:30 AM Jozef Lawrynowicz > wrote: > > > > On Thu, Oct 01, 2020 at 09:09:07PM +0930, Alan Modra via Binutils wrote: > > > On Thu, Oct 01, 2020 at 11:50:33AM +0100, Jozef Lawrynowicz wrote: > > > > --- a/bfd/elflink.c > > > > +++ b/bfd/elflink.c > > > > @@ -14102,7 +14102,8 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) > > > > || (elf_section_data (o)->this_hdr.sh_type > > > > == SHT_FINI_ARRAY))) > > > > || (elf_section_data (o)->this_hdr.sh_type == SHT_NOTE > > > > - && elf_next_in_group (o) == NULL ))) > > > > + && elf_next_in_group (o) == NULL) > > > > + || (elf_section_flags (o) & SHF_GNU_RETAIN))) > > > > > > Flag bits in SHF_MASKOS depend on OS, so this needs a test of OSABI. > > > That can be done by checking elf_tdata (sub)->has_gnu_osabi for the > > > appropriate bit. > > > > > > > Fixed the two OSABI issues in the attached patch. > > > > Please rebase since this part has been changed on master branch. > + || (elf_tdata (sub)->has_gnu_osabi & elf_gnu_osabi_retain + && elf_section_flags (o) & SHF_GNU_RETAIN))) Also please add () for elf_tdata (sub)->has_gnu_osabi & elf_gnu_osabi_retain and elf_section_flags (o) & SHF_GNU_RETAIN. -- H.J.