https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114532

--- Comment #5 from Zhaohaifeng <zhaohaifeng4 at huawei dot com> ---
(In reply to David Brown from comment #4)
> I'm not personally particularly interested in performance on x86 systems -
> my work is in embedded microcontroller programming.  But I did push for
> "-fno-common" to be the default in gcc because "-fcommon" greatly reduces
> the risk of some kinds of errors in code.
> 
> I've tried fiddling around a bit with different gcc targets and options on
> godbolt.org :
> 
> <https://godbolt.org/z/KqxKqeKbK>
> 
> It's easy to see the difference between common symbols and non-common
> symbols by using "-fcommon" and comparing non-initialised externally linked
> objects with initialised ones (since these are never common).  It seems that
> for some targets (like x86-64), there is no "-fsection-anchors" support at
> all.  For some (like mips), you can choose it explicitly.  And for some
> (like ARM 32-bit and 64-bit), it is automatic when optimising.  I assume
> section anchors can be a gain for some targets, but not so much for others.
> 
> So certainly "-fsection-anchors" will not be a help for x86-64, since that
> target does not support section anchors.  (And for targets that /do/ support
> them, such as ARM, it's important not to enable -fdata-sections since that
> blocks the anchors.)

Does gcc implement -fsection-anchors like function in -fcommon option for x86?
In general concept, gcc should has some similar feature for x86 and ARM.

Reply via email to