This is the mail archive of the binutils@sources.redhat.com 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: stripping symbols needed for relocations


Nick,

>> Wouldn't it make sense to prevent doing such (except when
--strip-all)
>> in the first place (binutils/objcopy.c, filter_symbols) rather than
>> generating an error message (bfd/elf.c,
>> _bfd_elf_symbol_from_bfd_symbol)? Or are there specific uses of
doing so
>> that would not result in such an error?
>
>I think that the only case where it would not matter is if the 
>relocation is in a section which is going to be discarded.  So to
answer 
>your first question, yes I think that filter_symbols() should try to 
>preserve reloc-used symbols unless --strip-all or --strip-symbol is in

>effect.  Note that the code does already try to do this by looking for

>the BSF_KEEP flag.

The --strip-all case is out of question, but my concern is primarily
with the combination of --strip-symbol/--strip-symbols and -w, but to
some degree also with the plain use of --strip-symbol/--strip-symbols:
When trying to cut down the number of symbols in the linux kernel
(subject to kallsyms lookup) I'm trying to eliminate all non-text
symbols. Finding them is not a problem, but filtering out those used in
relocations is, which is why I'd want objcopy to do this for me. Since
I'm of the general opinion that --strip-symbol for symbols used in
relocations for non-discarded sections (which I would hope already don't
get the BSF_KEEP flag set) will result in a broken output file, I'd like
to make objcopy smart enough to deal with that situation (possibly
through a new option --keep-needed or --force-strip-needed, depending on
what the desirable default would be and whether keeping the current
behavior is a requirement).

Jan


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