Add note merging to strip and add code to merge stack size notes.

* objcopy.c: Add --no-merge-notes option to disable note merging.
	Add --[no-]merge-notes option to strip, and enable it by default.
	(num_bytes): New function.
	(merge_gnu_build_notes): Add code to merge stack size notes.
	* binutils.texi: Update strip and objcopy documentation.
	* readelf.c (print_gnu_build_attribute_name): Use defined
	constants for note types.
This commit is contained in:
Nick Clifton
2017-04-13 14:50:56 +01:00
parent 4274208406
commit 1d15e434f4
4 changed files with 129 additions and 15 deletions

View File

@ -1191,6 +1191,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{--decompress-debug-sections}]
[@option{--elf-stt-common=@var{val}}]
[@option{--merge-notes}]
[@option{--no-merge-notes}]
[@option{-v}|@option{--verbose}]
[@option{-V}|@option{--version}]
[@option{--help}] [@option{--info}]
@ -2008,8 +2009,9 @@ converted to the @code{STT_COMMON} or @code{STT_OBJECT} type.
type to @code{STT_OBJECT}.
@item --merge-notes
For ELF files, attempt to reduce the size of any SHT_NOTE type
sections by removing duplicate notes.
@itemx --no-merge-notes
For ELF files, attempt (or do not attempt) to reduce the size of any
SHT_NOTE type sections by removing duplicate notes.
@item -V
@itemx --version
@ -3114,7 +3116,8 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
[@option{-s}|@option{--strip-all}]
[@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}]
[@option{--strip-dwo}]
[@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname}]
[@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}]
[@option{-M}|@option{--merge-notes}][@option{--no-merge-notes}]
[@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname}]
[@option{-w}|@option{--wildcard}]
[@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
@ -3241,6 +3244,13 @@ Remove all symbols that are not needed for relocation processing.
When stripping symbols, keep symbol @var{symbolname} even if it would
normally be stripped. This option may be given more than once.
@item -M
@itemx --merge-notes
@itemx --no-merge-notes
For ELF files, attempt (or do not attempt) to reduce the size of any
SHT_NOTE type sections by removing duplicate notes. The default is to
attempt this reduction.
@item -N @var{symbolname}
@itemx --strip-symbol=@var{symbolname}
Remove symbol @var{symbolname} from the source file. This option may be