Bug 18989 - please enable --push-state / --pop-state for gold
Summary: please enable --push-state / --pop-state for gold
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.25
: P2 enhancement
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-21 23:55 UTC by Matthias Klose
Modified: 2016-12-02 00:48 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2015-09-21 23:55:43 UTC
The bfd linker has support for enabling some options, and then falling back to the state it had before. please enable --push-state / --pop-state for gold as well.
Comment 1 cvs-commit@gcc.gnu.org 2016-12-02 00:33:47 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=376c3ecd17d0636bcf4e527c2e2ca2f94822fe64

commit 376c3ecd17d0636bcf4e527c2e2ca2f94822fe64
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Thu Dec 1 16:32:38 2016 -0800

    Implement --push-state/--pop-state.
    
    gold/
    	PR gold/18989
    	* options.cc (General_options::object_format_to_string): New function.
    	(General_options::copy_from_posdep_options): New function.
    	(General_options::parse_push_state): New function.
    	(General_options::parse_pop_state): New function.
    	* options.h (--push-state, --pop-state): New options.
    	(General_options::object_format_to_string): New method.
    	(General_options::set_incremental_disposition): New method.
    	(General_options::copy_from_posdep_options): New method.
    	(General_options::options_stack_): New data member.
Comment 2 Cary Coutant 2016-12-02 00:48:30 UTC
Implemented on trunk.

Unlike Gnu ld, gold implements this as a true stack: push and pop may
be nested to any depth.

The -r , -n, and -N options are listed in the Gnu linker manual among
the saved options, but they are not position-dependent options, and
have nothing to do with the treatment of input files. I have not
included them in the list of options saved. The position-dependent
options saved by --push-state in gold are:

    --as-needed/--no-as-needed
    -Bdynamic/-Bstatic/-dy/-dn
    --format
    --whole-archive/--no-whole-archive
    --incremental-changed/-unchanged/-unknown