This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support 'exclude' in objcopy --set-section-flags


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]