title: __attribute__ ((weak)) not work for global variable
body: <pre><code>pqy@localhost ~/src/test/a $ cat m.c
  #include &lt;stdio.h&gt;
  int aaaaa __attribute__ ((weak)) =8;
  int main(void){
      printf("%d\n", aaaaa);
      return 0;
  }
  pqy@localhost ~/src/test/a $ cat lib.c
  int aaaaa = 5;
  
  pqy@localhost ~/src/test/a $ gcc lib.c -fPIC -shared -o libb.so;gcc m.c -o m -L. -lb -Wl,-rpath=$PWD;./m
  8
  </code></pre>
  
  <p>Above is my code and test result. I am confused why it does not work as expected.</p>
  
  <p>Also try function, not work ether. Below is the test result.</p>
  
  <pre><code>pqy@localhost ~/src/test/a $ cat lib.c
  int fun() {
      return 5;
  }
  pqy@localhost ~/src/test/a $ cat m.c
  #include &lt;stdio.h&gt;
  __attribute__((weak)) int fun() {
      return 8;
  }
  int main(void){
      printf("%d\n", fun());
      return 0;
  }
  pqy@localhost ~/src/test/a $ gcc lib.c -fPIC -shared -o libb.so;gcc m.c -O0 -o m -L. -lb -Wl,-rpath=$PWD;./m
  8
  pqy@localhost ~/src/test/a $ ldd m
          linux-vdso.so.1 (0x00007ffd819ec000)
          libb.so =&gt; /home/pqy/src/test/a/libb.so (0x00007f7226738000)
          libc.so.6 =&gt; /lib64/libc.so.6 (0x00007f7226533000)
          /lib64/ld-linux-x86-64.so.2 (0x00007f7226744000)
  pqy@localhost ~/src/test/a $
  </code></pre>