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


Hi Jan,

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).

OK - I see your point. My original thinking was that if the user had specified --strip-symbol=foo on the objcopy command line then that meant that they definitely wanted "foo" stripped out, even if it was used in a reloc, and that they knew what they were doing.


Given that we are dealing with the binutils here, where you are allowed to shoot yourself in the foot if you do not know what you are doing, I think that this behaviour of the --strip-symbol switch should be retained. I would have no objections however to a patch which added another switch, say --strip-unused-symbol=<>, or indeed the --keep-needed switch you suggested, in order to provide a safer environment for stripping symbols.

Cheers
  Nick


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