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

            Bug ID: 84923
           Summary: gcc.dg/attr-weakref-1.c failed on aarch64
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vladimir.mezentsev at oracle dot com
  Target Milestone: ---

ramana.radhakrish...@arm.com implemented (2015-11-06, commit
cd4fcdb8ff16ec2dad56f9e736ac4552f8f52001)
a new feature ('Switch constant pools to separate rodata sections').
An additional fix is needed for this feature.

The test below demonstrates problem:
% cat t.c
extern void abort(void);
typedef int vtype;
static vtype Wv12 __attribute__((weakref ("wv12")));
extern vtype wv12 __attribute__((weak));

#define chk(p) do { if (!p) abort (); } while (0)

int main () {
  chk (!&Wv12);
  chk (!&wv12);
  return (0);
}

% gcc  t.c
/tmp/cciZgRxK.o:(.rodata+0x0): undefined reference to `wv12'
/tmp/cciZgRxK.o:(.rodata+0x8): undefined reference to `wv12'

% gcc  t.c -S
% cat t.s
....
        .size   main, .-main
        .weakref        Wv12,wv12   <<<<<<   Not here. This should be after
definitions of Wv12 and wv12.
Wv12        .section        .rodata
        .align  3
.LC0:
        .xword  Wv12
        .align  3
.LC1:
        .xword  wv12


It is a regression after fixing PR68256.
We can temporary restore Ramana's workaround in 
aarch64_use_blocks_for_constant_p to avoid this regression:
% git diff gcc/config/aarch64/aarch64.c                                         
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 4b5183b..222ea33 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7735,7 +7735,11 @@ aarch64_use_blocks_for_constant_p (machine_mode,
const_rtx)
 {
   /* We can't use blocks for constants when we're using a per-function
      constant pool.  */
-  return !aarch64_can_use_per_function_literal_pools_p ();
+  /* Fixme::
+     return !aarch64_can_use_per_function_literal_pools_p ();
+     This return statement breaks gcc.dg/attr-weakref-1.c test.
+     For now we workaround this by returning false here.  */
+  return false;
 }

Reply via email to