When trying to compile pr47276.c with additional -fpic option I've got the following error:
pr47276.c:36:1: warning: asm declaration ignored due to conflict with previous rename [-Wpragmas]
extern __typeof (__vsyslog_chk) __vsyslog_chk __asm__ ("" ASMNAME ("__GI___vsyslog_chk")) __attribute__ ((visibility ("hidden")));
../../../../gcc/gcc/testsuite/gcc.dg/pr47276.c:25:123: error: ‘__EI___vsyslog_chk’ aliased to undefined symbol ‘__GI___vsyslog_chk’
extern __typeof (__vsyslog_chk) __EI___vsyslog_chk __asm__("" ASMNAME ("__vsyslog_chk")); extern __typeof (__vsyslog_chk) __EI___vsyslog_chk __attribute__((alias ("" "__GI___vsyslog_chk")));
This fails all the way back to gcc 4.0 this way, and given that glibc itself builds fine even with gcc 4.7, I assume the testcase just doesn't match what glibc contained accurately.
Created attachment 28751 [details]
I tried to narrow down the problem and changed the test a little bit.
(The relative order of declarations remains the same; Just grouped the coupled declarations)
This changed test passes with -fno-pic and fails with -fpic.
BUT if we comment out the first group of definition/declarations
the test will fail with -fno-pic with the same problem, eventhough
those two groups are completely independent of each other
test case is attached in the previous comment