Re: Preventing preemption of 'protected' symbols in GNU ld 2.26 [aka should we revert the fix for 65248]

2016-04-19 Thread Cary Coutant
> As one of the strong advocates for the fix that was made to make > protected visibility work correctly with data symbols, I'd like to > explain why it was the right decision and why it matters. This whole > process is really frustrating to me -- having invested a lot of effort > into getting some

Re: Preventing preemption of 'protected' symbols in GNU ld 2.26 [aka should we revert the fix for 65248]

2016-04-19 Thread Cary Coutant
> Another old bug: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10908 Filed by you, and resolved (correctly) as invalid. Again, the real problem was the lack of a linker diagnostic. -cary

Re: Preventing preemption of 'protected' symbols in GNU ld 2.26 [aka should we revert the fix for 65248]

2016-04-19 Thread Cary Coutant
> Cary, please stop spreading the incorrect information. There is > at lease one GCC bug against protected symbol: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55012 > > which was reported by other people. OK, so it got reported once by someone else. But that bug was based on an incorrect un

Re: Preventing preemption of 'protected' symbols in GNU ld 2.26 [aka should we revert the fix for 65248]

2016-04-19 Thread Cary Coutant
>> So with all this it sounds that current protected visibility is just >> broken and we should forgo with it, making it equal to default >> visibility? > > Like how? You mean in GCC regarding protected as default visibility? No, > that's just throwing out the baby with the water. We should make

Re: Preventing preemption of 'protected' symbols in GNU ld 2.26 [aka should we revert the fix for 65248]

2016-04-18 Thread Cary Coutant
>> That is why protected visibility is such a mess. > > Not mess, but it comes with certain limitations. And that's okay. It's > intended as an optimization, and it should do that optimization if > requested, and error out if it can't be done for whatever reason. I completely agree. > E.g. one

Re: Preventing preemption of 'protected' symbols in GNU ld 2.26 [aka should we revert the fix for 65248]

2016-04-18 Thread Cary Coutant
>> Given a shared library that defines a variable, and a non-PIC >> executable that references that variable, the linker makes a duplicate >> of the variable in the executable .dynbss section and arranges to have >> the copy initialized by the dynamic loader with a copy relocation. >> .dynbss is a

Re: [GCC Wiki] Update of "DebugFission" by CaryCoutant

2016-03-21 Thread Cary Coutant
We're in the final stages of finalizing the DWARF v5 spec, which will include the Fission extensions. When that's done, we'll start converting GCC and gold over to use the official DWARF features rather than the GNU extensions. >> + The "Fission" project was started in response to the problems cau

Re: RFA: Add GCC Runtime Library Exception to include/plugin-api.h

2016-02-02 Thread Cary Coutant
> include/plugin-api.h defines an ABI between linker and compiler, > which can be used to implement linker plug-in by any compilers. > I'd like to add GCC Runtime Library Exception to include/plugin-api.h > so that the linker plug-in can have non-GPL licenses. This is OK with me. -cary

Re: [RFC] MIPS ABI Extension for IEEE Std 754 Non-Compliant Interlinking

2015-11-14 Thread Cary Coutant
> 3.3.2 Static Linking Object Acceptance Rules > > The static linker shall follow the user selection as to the linking mode > used, either of `strict' and `relaxed'. The selection will be made > according to the usual way assumed for the environment used, which may be > a command-line option, a p

Re: Adding static-PIE support to binutils

2015-08-18 Thread Cary Coutant
> Does static pie (ET_DYN with non-fixed load address, _DYNAMIC > relocations, but no PT_INTERP, DT_NEEDEDs, or symbolic relocations) > currently work with gold? If so, what is the way to request it? I > would say it would make sense to try to do things the same, but from > what you're saying it so

Re: Adding static-PIE support to binutils

2015-08-18 Thread Cary Coutant
> This is OK to commit with a suitable ChangeLog. I think a separate ld > option is best too, because historically -static and its aliases > -Bstatic, -dn, -non_shared really are about what type of libraries are > accepted rather than choosing linker output type. Gold actually separates these con

Re: Adding static-PIE support to binutils

2015-08-17 Thread Cary Coutant
> So far, I've been prototyping static PIE support by having GCC pass > the following options to ld instead of -static -pie: > > -static -shared -Bsymbolic > > This partly works, but since ld does not know it's producing a main > executable, it misses important details, including the abilit

Re: GCC Cauldron: Notes from the C++ ABI BOF

2013-01-22 Thread Cary Coutant
>> Normally, the version identifier is applied to a type. It then >> propagates to any declaration using that type, whether it's another >> type or function or variable. For struct/union/class types, if any >> member or base class has an attached version identifier (excluding >> static data members

Re: stabs support in binutils, gcc, and gdb

2013-01-14 Thread Cary Coutant
>> Next, I compiled a 5000-line C++ source file at both -O0 and -O2. > > I have to assume that David is working with C code, as stabs debugging > for C++ is nearly unusable. I assumed that too, but I figured C++ would be worse than C as far as DWARF vs. stabs size. I'd still be interested to figur

Re: stabs support in binutils, gcc, and gdb

2013-01-11 Thread Cary Coutant
>> If I use objcopy --compress-debug-sections to compress the DWARF debug >> info (but don't use it on the STABS debug info), then the file size >> ratio is 3.4. >> >> While 3.4 is certainly better than 11.5, unless I can come up with a >> solution where the ratio is less than 2, I'm not currently

Re: GCC Cauldron: Notes from the C++ ABI BOF

2013-01-10 Thread Cary Coutant
> We had a useful discussion about C++11 ABI issues at the GNU Tools > Cauldron (http://gcc.gnu.org/wiki/cauldron2012). The approach will be > shaped over time, but the general idea is as follows. > > We will modify g++ to support a type attribute indicating the version > of the type, as a string.

Re: Reserving a bit in ELF segment flags for huge page mappings

2012-07-24 Thread Cary Coutant
> To do this, I would like to reserve a bit in the segment flags to > indicate that this segment is to be mapped to huge pages if possible. > Can I reserve something like a PF_LARGE_PAGE bit? HP-UX has a PF_HP_PAGE_SIZE (0x0010) bit that says "Segment should be mapped with page size specifie

GCC Cauldron: Notes from the C++ ABI BOF

2012-07-11 Thread Cary Coutant
string & list changes - function w/ string arg - classes w/ string members - global variables - link c++98 & c++0x together - link existing c++98 .o & new c++-x .o - link at runtime c++98 .so & new c++0x .so HP: attribute on type propagates to: - function (params or return type) - structs w/ mem

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Cary Coutant
> But I am still missing something, why is the performance so different? > Code layout putting the constructors' body in the reverse order they > are called? Yes, as I understand it. Cache and TLB prefetching works better when code executes from lower to higher addresses than when executing from h

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Cary Coutant
>> Furthermore, if you're working in chromium, you should be aware that >> the new behavior is exactly what the Chrome developers are arguing >> for, as it makes the startup faster. It sounds to me like you're >> working at cross purposes with the other developers on that project. > > Ah, perhaps t

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Cary Coutant
> So this is not as bad as I was expecting (old programs still work), > but it is still a somewhat annoying ABI change to handle. I think we > can add support for this in clang in 3 ways: > > 1) Require new linkers when using gcc 4.7 libraries. > 2) Ship our own versions of crtbeginS.o (and similar

Re: RFC: Add STB_GNU_SECONDARY

2012-04-20 Thread Cary Coutant
> We only have very few bits to in STB_XXX field. This is exactly why I'm not in favor of this extension. The feature doesn't seem compelling enough to use up one of these precious reserved values (in fact, you're using the next-to-last one that's reserved for OS use). You want a backup definitio

Re: Debug info for comdat functions

2012-04-18 Thread Cary Coutant
> This seems clearly wrong to me.  A reference to a symbol in a discarded > section should not resolve to an offset into a different section.  I thought > the linker always resolved such references to 0, and I think that is what we > want. Even resolving to 0 can cause problems. In the Gnu linker,

Re: Dealing with compilers that pretend to be GCC

2012-01-20 Thread Cary Coutant
> Yeah, but it’s a shame that those compilers define __GNUC__ without > supporting 100% of the GNU C extensions.  With this approach, you would > also need to add !defined for Clang, PGI, and probably others. Having worked on the other side for a while -- for a vendor whose compiler supported many

Re: Getting rid of duplicate .debug_ranges

2012-01-20 Thread Cary Coutant
>> Is there a way to detect that basic blocks have the same range even >> though they have different block numbers? Or am I not looking/thinking >> about this issue correctly? I may be oversimplifying this, but it seems that gen_inlined_subroutine_die generates a DW_AT_ranges list, then calls decl

[RFC] New git-only branch for Fission project

2011-10-19 Thread Cary Coutant
I'd like to create a new "fission" branch on the GIT mirror at ssh://gcc.gnu.org/git/gcc.git. This branch will host the changes that Sterling and I will be making to support splitting the debug info into separate files -- and, as a byproduct, fixing the pubnames and pubtypes tables so they can be u

Re: RFC: DWARF Extensions for Separate Debug Info Files ("Fission")

2011-09-23 Thread Cary Coutant
> The Apple approach has both the features of the Sun/HP implementation as well > as the ability to create a standalone debug info file. Thanks for the clarifications. I based my comments on a description you sent me a couple of years ago, and I apologize for any oversimplifications I introduced.

Re: RFC: DWARF Extensions for Separate Debug Info Files ("Fission")

2011-09-23 Thread Cary Coutant
>> * .debug_pubtypes - Public types for use in building the >>   .gdb_index section at link time. This section will have an >>   extended format to allow it to represent both types in the >>   .debug_dwo_info section and type units in .debug_types. >    ^^^ >    = .dwo_info , maybe both

RFC: DWARF Extensions for Separate Debug Info Files ("Fission")

2011-09-22 Thread Cary Coutant
At Google, we've found that the cost of linking applications with debug info is much too high. A large C++ application that might be, say, 200MB without debug info, is somewhere around 1GB with debug info, and the total size of the object files that we send to the linker is around 5GB (and that's w

Re: GCC 4.4/4.6/4.7 uninitialized warning regression?

2011-04-20 Thread Cary Coutant
> This brings out 2 questions.  Why don't GCC 4.4/4.6/4.7 warn it? > Why doesn't 64bit GCC 4.2 warn it? Good question. It seems that the difference is whether the compiler generates a field-by-field copy or a call to memcpy(). According to David, the trunk gcc in 32-bit mode doesn't call memcpy, b

Re: DW_AT_GNU_odr_signature

2011-04-04 Thread Cary Coutant
> I saw that dwarf2out.c (generate_type_signature) does not just calculate > the complete type signature for use with DW_AT_signature, but also > outputs a DW_AT_GNU_odr_signature. The comment says: > > /* First, compute a signature for just the type name (and its >   surrounding context, if any.  

Re: PATCH: 2 stage BFD linker for LTO plugin

2011-01-19 Thread Cary Coutant
>> I'm not sure if with your patch the add_input_library or >> add_input_file plugin hooks are completely useless (and thus >> gold could simply ignore those at all). > > The plugin does need to use the add_input_file callback.  In any case > I'm not sure it's a great idea for gold to ignore a hook

Re: PATCH: 2 stage BFD linker for LTO plugin

2010-12-13 Thread Cary Coutant
> Here is an alternative proposal, with a patch for gold. > > We add a new plugin vector: LDPT_REGISTER_RESCAN_ARCHIVE_HOOK.  Like > LDPT_REGISTER_CLAIM_FILE_HOOK, this gives the plugin the address of a > function which can register a plugin function: rescan_archive. > > typedef > enum ld_plugin_st

Re: "ld -r" on mixed IR/non-IR objects (

2010-12-07 Thread Cary Coutant
> Here is my proposal.  Any comments? We talked about ld -r a while back during the WHOPR project, and the two ways that the linker could work: (1) combine all the .o files and use the plugin to run LTRANS on the IR files, producing a pure, optimized, object file; and (2) combine the non-IR object

Re: PATCH: 2 stage BFD linker for LTO plugin

2010-12-06 Thread Cary Coutant
>>> I see no particular reason why that should be the case.  The issues are >>> conceptually simple. >> >> I'd like to a gold implementation which works on all known cases. You'd like to what? > BTW, gold LTO plugin miscompiled 416.gamess in SPEC CPU 2006: > > http://www.sourceware.org/bugzilla/s

Re: Update LTO plugin interface

2010-12-03 Thread Cary Coutant
>>> Another way to do this would be to put a marker in the command line >>> that identifies where those libraries begin, and the linker could just >>> go back and rescan those libraries if needed, before the final layout >>> of the endcaps. >> >> I like that idea in general, but the difficulty is k

Re: Update LTO plugin interface

2010-12-03 Thread Cary Coutant
> For the crtend files we could add a linker option that makes them > known as endcaps, and the linker could make sure they get laid out > last: > >   ld ... -lc -lgcc ... --endcap crtend.o crtn.o > > That puts the special knowledge about those files back in the gcc driver. I should have remembere

Re: Update LTO plugin interface

2010-12-02 Thread Cary Coutant
>> I wouldn't expect the compiler to introduce a call to anything in libm >> when -lm isn't already specified on the command line (that would break >> even without LTO). > > Right--that would break without LTO, but it doesn't follow that we > should make it work with LTO. That's my point, too. >>

Re: Update LTO plugin interface

2010-12-02 Thread Cary Coutant
> This isn't quite what should happen, though.  If the user does not > specify -lm on the link line, then we should not add -lm, even if LTO > somehow introduces a function that is defined in libm.  Automatically > adding -lm would introduce a surprising dynamic dependency in some > cases.  The use

Re: Update LTO plugin interface

2010-12-02 Thread Cary Coutant
>> For the crtend files we could add a linker option that makes them >> known as endcaps, and the linker could make sure they get laid out >> last: >> >>    ld ... -lc -lgcc ... --endcap crtend.o crtn.o >> >> That puts the special knowledge about those files back in the gcc driver. > >  Hmm, yes.  

Re: Update LTO plugin interface

2010-12-02 Thread Cary Coutant
> For each libcall, we need to decorate > > 1. Which library it comes from. It is OS/target dependent. > 2. The dynamic and static library names.  In most cases,  they > are the same.  For glibc, they are different. Is there a relatively painless way to enumerate all the possible libcalls? We coul

Re: Update LTO plugin interface

2010-12-02 Thread Cary Coutant
> I propose that we add a new linker option: --plugin-callback.  At each > point where this option appears on the command line, the linker will > call a new plugin callback entry point.  The LTO plugin will replace the > all_symbols_read callback with this one.  We will have the gcc driver > run th

Re: Update LTO plugin interface

2010-12-02 Thread Cary Coutant
>  I'm wondering if the linker shouldn't just gather the plugin-contributed > object files, substitute them into appropriate places on the original > command-line, and re-exec itself. That's not effectively different from the collect2 approach that we had before the linker plugin interface. The on

Re: Update LTO plugin interface

2010-12-01 Thread Cary Coutant
>> I'm also not sure what you mean by "resolved IRONLY except that it is >> externally visible to the dynamic linker." If we're building a shared >> library, and the symbol is exported, it's not going to be IRONLY, and >> I don't see how it would be valid to optimize it out. If we're > > Well, the

Re: Update LTO plugin interface

2010-12-01 Thread Cary Coutant
>> The only aspect of link >> order that isn't maintained is the physical order of the sections in >> memory. > > That is exactly the problem my proposal tries to address. Really? That's not at all what PR 12248 is about. The physical order of the sections (meaning the order of contributions withi

Re: Update LTO plugin interface

2010-12-01 Thread Cary Coutant
>> That is what "Discard all previous inputs" in stage 2 linking is for. > > But what does that mean?  Are you saying that the linker interface to > the plugin should change to work that way?  If we do that, then we > should change other aspects of the plugin interface as well.  It could > probably

Re: Update LTO plugin interface

2010-12-01 Thread Cary Coutant
> If we get into extending linker plugin interface, it would be great if we > would > do somehting about COMDAT.  We now have RESOLVED and RESOLVED_IRONLY, while > the > problem is that all non-hidden COMDAT symbols get RESOLVED that pretty much > fixes them in the output library. > > I would pro

Re: Issue with LTO/-fwhole-program

2010-06-11 Thread Cary Coutant
> But if I understand correctly, mixed LTO/non-LTO + whole-program is > almost never correct. So we should really emit a warning for this > specific combination. I think making this mistake would be quite easy > but hard to debug. It's not only correct, it's essential. "Whole Program" doesn't mean

Re: externally_visible and resoultion file

2010-06-09 Thread Cary Coutant
>> Yes, this is also what I saw without plugin. I just wonder why "v" >> is linked with plugin if resolution file is not used to eliminate need >> of externally_visible attribute here. > > Probably because of the same linker-plugin bug that causes bar > to be resolved. Just to make sure I unde

Re: GCC 4.5 Status Report (2009-09-19)

2009-09-21 Thread Cary Coutant
> extensibility, this isn't a problem for these extensions, as older > DWARF readers will simply ignore the location expressions that use the > extensions -- which produces the same behavior as DWARF-2 without > those extensions. I said "will simply ignore" when I guess I should have said "should

Re: GCC 4.5 Status Report (2009-09-19)

2009-09-21 Thread Cary Coutant
>   Are you saying that current gcc trunk should require -gdwarf-4 > to issue dwarf4 commands? I ask because r151815... > > http://gcc.gnu.org/ml/gcc-patches/2009-09/msg00220.html > > causes dwarf4 by default. Is there a consistent policy on this? > Currently in PR41405, there is a proposal for a -

Re: GCC 4.5 Status Report (2009-09-19)

2009-09-21 Thread Cary Coutant
>>   So aren't we now likely to lose the first few days of what little remains >> of >> stage 1 waiting for trunk to start working again, then have a mad rush of >> people falling all over each other to get their new features in in the last >> couple of days?  One of which will inevitably break tr

Re: Redirecting I/O

2009-04-10 Thread Cary Coutant
(This question probably should be on gcc-help instead of this list.) > I'm trying to redirect I/O in my C++ application and am having some > difficulty. I am trying to use cout or a file for output based on some > condition. cout is an ostream object and file is an ofstream object. > The types are

Re: generating functions and eh region

2009-04-02 Thread Cary Coutant
> With SEH you can catch that kind of errors and that's why it's so > interesting in embedded world That's also why SEH is a major pain for optimization. The compiler would have to identify every instruction that may trigger an exception, and either treat that instruction as a scheduling boundary

Re: Mixing languages in the same TU and dwarf2out_frame_finish

2009-01-07 Thread Cary Coutant
> However, on LTO, we may have several personality functions in the same > object file. So, it's not clear what should we do here. Should we > call dwarf2out_frame_finish() for each of the personalities that we > saw in that file? I don't think so. We're calling dwarf2out_frame_finish() at the en

[lto] [RFC] Design proposal for debug support in LTO

2008-12-23 Thread Cary Coutant
LTO currently doesn't support the generation of debug info very well, as we discard much of the front-end information that is needed for debug info before streaming the IR to the intermediate file. I've written up the following proposal to fix this, and have also posted it on the gcc wiki: http:

Re: gdb test suite failure on i386 and x86_64 in gdb.base/break.exp

2008-09-13 Thread Cary Coutant
> This is PR 36690 which has various bits of analysis. Thanks! I did search for this problem, but I guess I didn't use the right terms, and it didn't turn up this bug report. Looks like if I had done another search after analyzing the problem, it probably would have turned up. -cary

gdb test suite failure on i386 and x86_64 in gdb.base/break.exp

2008-09-12 Thread Cary Coutant
There are a couple of failures in the gdb test suite on i386 and x86_64 with gcc 4.3.0 or newer. The tests gdb.base/break.exp and gdb.base/sepdebug.exp are failing with a function begins with a while loop. The into_cfg_layout_mode pass was added in 4.3.0 (see http://gcc.gnu.org/ml/gcc-patches/2007-

Re: [whopr] Design/implementation alternatives for the driver and WPA

2008-07-06 Thread Cary Coutant
> On the "claim file", can you also pass the "file" size in the case it > is inside an archive? Good idea. Will do. -cary

Re: [whopr] Design/implementation alternatives for the driver and WPA

2008-07-06 Thread Cary Coutant
> * "End of first pass" may be a little gold specific. Perhaps it > should be called something like "after all input files have been > seen." Sure. It seems to me that the pass 1, middle, pass 2 breakdown is pretty common for linkers, though perhaps not universal. I'll find a better name (I was

Re: [whopr] Design/implementation alternatives for the driver and WPA

2008-07-03 Thread Cary Coutant
> We've started working on the driver and WPA components for whopr. > These are some of our initial thoughts and implementation strategy. I > have linked these to the WHOPR page as well. I'm hoping we can > discuss these at the Summit BoF, so I'm posting them now to start the > discussion. I've

Re: How to reserve an Elf e_machine value

2008-06-06 Thread Cary Coutant
Let me second H.J.'s suggestion to post your request at http://groups.google.com/group/generic-abi In the absence of any SCO presence, that group now serves as the closest thing we have to a standards forum for ELF and the gABI. -cary

Re: ln -r and cherry picking.

2008-06-06 Thread Cary Coutant
> I think that one of the goals here is to not make that too dependent on elf. > For instance, we are in the process of getting rid of all of the dwarf. > After maddox does that, our only dependence on elf will be as a container > to hold all of the sections. > Given that gcc is not always an elf

Re: ln -r and cherry picking.

2008-06-06 Thread Cary Coutant
> 2) LTO sections need to be able to find "their index" of decls and > types. By "their index" I mean the index that each section used to > reference the decls and types when the section was generated. Can't you just put an ELF symbol (can be an unnamed local -- could even just be a section sy