On Mon, Dec 22, 2014 at 2:40 PM, H.J. Lu wrote: > On Mon, Dec 22, 2014 at 9:37 AM, Cary Coutant wrote: >>> Here is an idea. Does it look OK? >> >> I don't like the idea of making a file named "crtbegin" magic, and >> with this patch, any link *without* such a file will no longer >> optimize eh data. >> >> -cary > > How about this? We do this only when there is a crtbeginT file > on command line? > > -- > H.J. > --- > PR gold/14675 > * ehframe.cc (Eh_frame::add_ehframe_input_section): Force the > exception frame section from input files if it can't be > optimized. > (Eh_frame::add_ehframe_input_section<32, false>): Updated. > (Eh_frame::add_ehframe_input_section<32, true>): Likewise. > (Eh_frame::add_ehframe_input_section<64, false>): Likewise. > (Eh_frame::add_ehframe_input_section<64, true>): Likewise. > * ehframe.h (Eh_frame::add_ehframe_input_section): Add a > bool parameter to indicate if the exception frame section > can be optimized. > * layout.cc (Layout::Layout): Initialize has_crtbeginT_ to > has_crtbeginT and optimize_ehframe_ to !has_crtbeginT. > (Layout::layout_eh_frame): Pass this->optimize_ehframe_ to > Eh_frame::add_ehframe_input_section. > (Layout::make_eh_frame_section): Set this->optimize_ehframe_ > to true when processing the crtbeginT file if it is on command > line. > (Layout::match_file_name (const char*, const char*)): New. > (Layout::match_file_name(const Relobj*, const char*): Use it. > * layout.h (Layout::Layout): Add has_crtbeginT. > (Layout::match_file_name (const char*, const char*)): New. > (Layout): Add has_crtbeginT_ and optimize_ehframe_ members. > * main.cc (main): Update layout. > * options.cc (Input_arguments::add_file): Set > this->has_crtbeginT_ to true if there is a crtbeginT file. > * options.h (Input_arguments::Input_arguments): Initialize > has_crtbeginT_. > (Input_arguments::has_crtbeginT): New function. > (Input_arguments::has_crtbeginT_): New bool member. > (Command_line::crtbeginT): New function. Slightly updated patch. We don't need to add a has_crtbeginT_ member to Layout. optimize_ehframe_ is sufficient. -- H.J.