I generated object files using clang and gcc as follows:
$ clang -o globaltest_clang.o -c globaltest.c
$ gcc -o globaltest_gcc.o -c globaltest.c
I notice that gcc generated encoding of the instruction that moves 5
to global is pc-relative location but clang generated encoding of the
same instruction is 0-reg relative (See instruction at location 4 in
the objdumps below).
I understand upon linking this object (given the relocation record)
with other objects to get a final executable (or DSO) results in a
fully functional binary. But, as far as the correctness of generated
object code, is this a bug?