This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Link time checking for incompatible flags
- From: Mike Stump <mrs at apple dot com>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: Ian Lance Taylor <ian at wasabisystems dot com>, Rahul Joshi <rujoshi at uiuc dot edu>, gcc at gcc dot gnu dot org
- Date: Thu, 22 Apr 2004 04:54:32 -0700
- Subject: Re: Link time checking for incompatible flags
On Thursday, April 22, 2004, at 12:16 AM, Alan Modra wrote:
On Wed, Apr 21, 2004 at 07:02:24PM -0700, Mike Stump wrote:
On Wednesday, April 21, 2004, at 06:24 PM, Ian Lance Taylor wrote:
The linker currently has no mechanism for anything like this.
Doesn't it? The compiler is free to create link once sections that
are
named something like gcc.options.fshort-enums and place in it a 0 or a
1, and then mark up that section as having the linker validate that
the
section is the same in all units, and not loaded, and then presto, if
you compile two units that differ in this flag, automagic link error?
No. GNU ld doesn't compare section contents.
Ah, but it can still be done. It does compare size, so one merely has
to encode the value into the size instead of the contents of the
section. I suspect one could add the memcmp to ldlang.c, if one wanted.
SEC_LINK_DUPLICATES_SAME_CONTENTS is supposed to do this, but I see it
isn't fully implemented.