Le 09/03/2020 à 13:43, Bruce Dubbs via blfs-dev a écrit :
> On 3/8/20 10:49 PM, Xi Ruoyao via blfs-dev wrote:
>> GCC 10 will enable -fno-common by default.  It would break some "legacy"
>> (actually buggy IMO) code.  I found some cases in the book with GCC 9 and 
>> -fno-
>> common explicitly enabled.
>>
>> Patches uploaded to
>> http://www.linuxfromscratch.org/~xry111/fno-common-patches/.
>> I hope the upstream can fix these cases before GCC 10 (for SDL2, xorg-server
>> and
>> pipewire the fix is already commited).  But if they don't we can grab these
>> patches as needed.
> 
> Thanks for that.  One question though.  When I go to
> https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html is says
> 
> "The default is -fno-common, which specifies that the compiler places
> uninitialized global variables in the BSS section of the object file. This
> inhibits the merging of tentative definitions by the linker so you get a
> multiple-definition error if the same variable is accidentally defined in more
> than one compilation unit."
> 
> I would read the above to indicate that -fno-common is default for gcc9 also.
> 
> Comments?
> 

In the info file for gcc-9.2.0:

     Unix C compilers have traditionally allocated storage for
     uninitialized global variables in a common block.  This allows the
     linker to resolve all tentative definitions of the same variable in
     different compilation units to the same object, or to a
     non-tentative definition.  This is the behavior specified by
     '-fcommon', and is the default for GCC on most targets.  On the
     other hand, this behavior is not required by ISO C, and on some
     targets may carry a speed or code size penalty on variable
     references.

So I think the internet version is for GCC 10.

Pierre
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to