This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Support 'exclude' in objcopy --set-section-flags
- From: Fangrui Song <i at maskray dot me>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Mon, 10 Feb 2020 10:08:10 -0800
- Subject: Re: [PATCH] Support 'exclude' in objcopy --set-section-flags
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=maskray.me; dmarc=pass action=none header.from=maskray.me; dkim=pass header.d=maskray.me; arc=none
- 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=vSoniA1eH0fpWZbEpnEWQ7uEpS6qqABw3uupnmX3V+Y=; b=jLe+8B8uDtKUN70jFtOHwtVA6oPzaAVEorlR1vqjadi3IXjX6valaGrYSIH7f+4EItIKpwwmeIXjEe4I/G0eyUtRfJL915ctIqHD30PzBYcXx0Q5QDi8U84B05GDjQOOPrcRCwXmZRG0Rx2dEMX6UZb0UhwaQi8kiEBtKxMk+bwUhNxDTNqmyRZwk+V9so5Zn16tFAfepPBTtqIumMN1oT9WFVwH7/gbb57Jq1K8kCzPEOvYjchywz6cprOwvSGLMLJISnps/AyPBwKL7FLFFYZbe4aV3Umee0/4AsfXRk80RHxBp2Oxyu6l43/bWe9EcZYCyiTOcJ/2RunGF4XfmQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggAGGVcs4Ku24ZF3mRPZbnP5yUiv+UTMxd1bryJOuXQ+xbetLF/Drn44scwRDIPW+hLDC6dyuU54nnYcV/iZLV2JO/5364/1a+6OODBtKNOZbGs7yknKdAKoEZOuZbjPehHSQ//csep62AS8YCMCpxsccZWtYMeyHPWiMAakJLsohhwMf9xqSImFsY9QVpWPhzRREdaG6UkHScj+gZVF6evE0PDn3maBRsdFqDqc3hQLf/5455A4U3NJJZh73PXhHjRvaW7JC63sYneWteXzXhFdduBlPLdOv3WZbKG9pwmSu9QsJSaFzNRSp+Z5xNKjftC8d9XH6Sr3NvJblfKpWA==
- References: <20200116085509.pttoo3atw34dbl3m@google.com> <20200203060029.a3mora6uaadropos@google.com> <3390c868-a19f-e3cf-4cbd-27dfd507d43f@redhat.com>
On Mon, Feb 10, 2020 at 8:24 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi Fangrui,
>
> >> --set-section-flags .foo= => clear SHF_EXCLUDE
> >> --set-section-flags .foo=exclude => set SHF_EXCLUDE
> >
> > Ping :)
>
> Approved and applied - mostly. You also had an undocumented
> change to _bfd_elf_init_private_section_data() which would
> remove the SHF_EXCLUDE bit from sections with OS or PROC
> specific flags. This breaks several linker tests, and seemed
> to be unrelated to the main purpose of the patch, so I discarded
> it.
Thanks! I'm curious to learn what SHF_MASKPROC tests on what archs are affected,
and how you made the test.
The main issue is that (SHF_EXCLUDE & SHF_MASKPROC) != 0.
SHF_EXCLUDE = SHF_ARM_COMDEF = SHF_MIPS_STRINGS = SHF_PARISC_SBP
If we don't drop the SHF_EXCLUDE bit,
https://sourceware.org/bugzilla/show_bug.cgi?id=25371#c1
exclude will behave differently from other flags.
% cat a.s
.section foo,"e"
% as a.s -o a.o
% llvm-objcopy --set-section-flags foo=readonly a.o b.o #
LLVM>=10.0.0 , SHF_EXCLUDE is dropped
% objcopy --set-section-flags foo=readonly a.o b.o # SHF_EXCLUDE is kept
This is probably not a problem because in practice no users will use
--set-section-flags on sections with such flags.