[PATCH] D37733: [ELF} - Implement --push-state/--pop-state.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 02:24:35 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

This is PR34567 ("Bug 34567 - lld: unknown argument: --push-state, --pop-state on ubuntu when using asan")

Documentation (https://sourceware.org/binutils/docs/ld/Options.html) specifies these options as:

--push-state
The --push-state allows to preserve the current state of the flags which govern the input file handling so that they can all be restored with one corresponding --pop-state option.
The option which are covered are: -Bdynamic, -Bstatic, -dn, -dy, -call_shared, -non_shared, -static, -N, -n, --whole-archive, --no-whole-archive, -r, -Ur, --copy-dt-needed-entries, --no-copy-dt-needed-entries, --as-needed, --no-as-needed, and -a.
--pop-state
Undoes the effect of –push-state, restores the previous values of the flags governing input file handling.

gold implementation was: https://sourceware.org/bugzilla/show_bug.cgi?id=18989.

Unlike said in specification, gold preserves only position-dependent options. And that behavior looks correct for me, 
I do not see any reasons to preserve/restore position-independent options. Also gold implements real stack with nesting to any depth. 
I do not think we really need to do that, at least until bfd does not supports the same. 
This patch implements probably simplest way I can imagine.


https://reviews.llvm.org/D37733

Files:
  ELF/Driver.cpp
  ELF/Options.td
  test/ELF/as-needed.s
  test/ELF/format-binary.test
  test/ELF/libsearch.s
  test/ELF/whole-archive.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37733.114785.patch
Type: text/x-patch
Size: 4319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170912/99cf0271/attachment.bin>


More information about the llvm-commits mailing list