This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RHBZ#150150] emit aliased static functions in -fno-unit-at-a-time


On Fri, Mar 04, 2005 at 12:01:51AM -0300, Alexandre Oliva wrote:
> We refrained from telling the cgraph infrastructure that a symbol is
> referenced through an emitted alias just because we were not in
> -funit-at-a-time, but the assumption that this is only needed in
> unit-at-a-time mode is incorrect: static functions are not emitted at
> the point they're encountered even in -fno-unit-at-a-time, and if we
> don't add the edges to the graph and no other references to the static
> symbol exist, we may end up not emitting it at all.
> 
> I'm testing this patch to fix the problem.  Ok to install if bootstrap
> and regtest on x86_64-linux-gnu succeeds?
> 

Unfortunately, it seems this patch causes some regressions, particularly:
FAIL: gcc.dg/special/alias-1.c (test for excess errors)
FAIL: gcc.dg/special/wkali-1.c (test for excess errors)
FAIL: gcc.dg/special/wkali-2.c (test for excess errors)
FAIL: gcc.dg/tls/alias-1.c (test for excess errors)
FAIL: gcc.dg/weak/weak-3.c (test for excess errors)
FAIL: gcc.dg/weak/weak-5.c (test for excess errors)
FAIL: gcc.dg/weak/weak-9.c (test for excess errors)

With unpatched GCC the warnings are:

for i in /tmp/*.c; do LC_ALL=C gcc -S -fno-common $i; done
/tmp/weak-3.c:37: warning: weak declaration of 'ffoo1c' after first use results in unspecified behavior
/tmp/weak-3.c: In function 'foo1f':
/tmp/weak-3.c:58: warning: the address of 'ffoo1f', will always evaluate as 'true'
/tmp/weak-3.c: At top level:
/tmp/weak-3.c:62: warning: weak declaration of 'ffoo1f' after first use results in unspecified behavior
/tmp/weak-5.c:42: warning: weak declaration of 'vfoo1c' after first use results in unspecified behavior
/tmp/weak-5.c:66: warning: weak declaration of 'vfoo1f' after first use results in unspecified behavior
/tmp/weak-5.c:74: warning: weak declaration of 'vfoo1g' after first use results in unspecified behavior

While with patched GCC the warnings are:

for i in /tmp/*.c; do LC_ALL=C ./xgcc -B ./ -S -fno-common $i; done
/tmp/alias-1.c:6: warning: 'foo' aliased to undefined symbol 'bar'
/tmp/tls_alias-1.c:23: warning: 'bar' aliased to undefined symbol 'foo'
/tmp/weak-3.c:37: warning: weak declaration of 'ffoo1c' after first use results in unspecified behavior
/tmp/weak-3.c: In function 'foo1f':
/tmp/weak-3.c:58: warning: the address of 'ffoo1f', will always evaluate as 'true'
/tmp/weak-3.c: At top level:
/tmp/weak-3.c:62: warning: weak declaration of 'ffoo1f' after first use results in unspecified behavior
/tmp/weak-3.c:62: warning: 'ffoo1f' aliased to undefined symbol 'ffoox1f'
/tmp/weak-3.c:67: warning: 'ffoo1g' aliased to undefined symbol 'ffoox1g'
/tmp/weak-5.c:42: warning: weak declaration of 'vfoo1c' after first use results in unspecified behavior
/tmp/weak-5.c:66: warning: weak declaration of 'vfoo1f' after first use results in unspecified behavior
/tmp/weak-5.c:74: warning: weak declaration of 'vfoo1g' after first use results in unspecified behavior
/tmp/weak-5.c:109: warning: 'vfoo1l' aliased to undefined symbol 'vfoox1l'
/tmp/weak-9.c:15: warning: 'f1' aliased to undefined symbol 'notf1'
/tmp/weak-9.c:16: warning: 'f2' aliased to undefined symbol 'notf2'
/tmp/weak-9.c:19: warning: 'f3' aliased to undefined symbol 'notf3'
/tmp/weak-9.c:22: warning: 'f4' aliased to undefined symbol 'notf4'
/tmp/wkali-1.c:7: warning: 'foo' aliased to undefined symbol 'bar'

Some of these already show in -funit-at-a-time mode in unpatched compiler:

for i in /tmp/*.c; do LC_ALL=C gcc -funit-at-a-time -S -fno-common $i; done
/tmp/alias-1.c:6: warning: 'foo' aliased to undefined symbol 'bar'
/tmp/tls_alias-1.c:23: warning: 'bar' aliased to undefined symbol 'foo'
/tmp/weak-3.c: In function 'foo1f':
/tmp/weak-3.c:58: warning: the address of 'ffoo1f', will always evaluate as 'true'
/tmp/weak-3.c: At top level:
/tmp/weak-3.c:62: warning: 'ffoo1f' aliased to undefined symbol 'ffoox1f'
/tmp/weak-3.c:67: warning: 'ffoo1g' aliased to undefined symbol 'ffoox1g'
/tmp/weak-9.c:15: warning: 'f1' aliased to undefined symbol 'notf1'
/tmp/weak-9.c:16: warning: 'f2' aliased to undefined symbol 'notf2'
/tmp/weak-9.c:19: warning: 'f3' aliased to undefined symbol 'notf3'
/tmp/weak-9.c:22: warning: 'f4' aliased to undefined symbol 'notf4'
/tmp/wkali-1.c:7: warning: 'foo' aliased to undefined symbol 'bar'

BTW, the aliased to undefined symbol warning breaks the hacks that
provide non-intrusive "protected" visibility in packages like
libxml2, gtk+, etc. ("protected" as opposed to standard protected
visibility in that calls to functions within the same library are
going to hidden aliases, so they work almost like protected symbols,
but don't have the huge overhead of protected symbols).

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]