title: Very strange linker behavior
body: <p>This is strange because I was able to get the error below to go away by removing the reference to libm.</p>
  
  <pre><code>gcc -o example example.o -Wl -L/home/kensey/cdev/lib -L/usr/lib/x86_64-linux-gnu   -lmysqlclient -lpthread -lz -L/usr/lib/x86_64-linux-gnu -lm -lrt -ldl -lcdev -L/home/kensey/www.tools/gplot-lib -lgplot -L/home/kensey/www.tools/gd1_3ret -lgd -lxml2 -lcurl
  /usr/bin/ld: /home/kensey/www.tools/gplot-lib/libgplot.a(set.o): undefined reference to symbol 'floor@@GLIBC_2.2.5'
  /usr/bin/ld: note: 'floor@@GLIBC_2.2.5' is defined in DSO /usr/lib/x86_64-linux-gnu/libm.so so try adding it to the linker command line
  /usr/lib/x86_64-linux-gnu/libm.so: could not read symbols: Invalid operation
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>So, if I remove the <code>-lm</code> part of the command, I do not get the error.  However, I wonder if anyone knows as to why removing a reference to a library that is needed would fix this.  How does the linker know which library to look in?  Also - is there a way to query a built executable and say 'which library did you resolve the reference to 'floor'?  obviously, there is something going on that I don't understand, and that bothers me... </p>