1

i have installed new glib library version 2.6 , And after creation i am trying to rename some of the symbols in glib library using objcopy command. Renaming symbols is necessary for our project support.

It fails with error below

objcopy --redefine-syms=glibrename libglib-2.0.a
BFD: libglib-2.0.a(deprecated_gcompletion.c.o): invalid relocation type 42
BFD: BFD version 2.20.51.0.2-5.36.el6 20100205 assertion fail elf64-x86-64.c:290
BFD: libglib-2.0.a(deprecated_gthread-deprecated.c.o): invalid relocation type 42
BFD: BFD version 2.20.51.0.2-5.36.el6 20100205 assertion fail elf64-x86-64.c:290
BFD: libglib-2.0.a(deprecated_gthread-deprecated.c.o): invalid relocation type 42
BFD: BFD version 2.20.51.0.2-5.36.el6 20100205 assertion fail elf64-x86-64.c:290
BFD: libglib-2.0.a(deprecated_gthread-deprecated.c.o): invalid relocation type 42
BFD: BFD version 2.20.51.0.2-5.36.el6 20100205 assertion fail elf64-x86-64.c:290
BFD: libglib-2.0.a(deprecated_gthread-deprecated.c.o): invalid relocation type 42
BFD: BFD version 2.20.51.0.2-5.36.el6 20100205 assertion fail elf64-x86-64.c:290
BFD: libglib-2.0.a(deprecated_gthread-deprecated.c.o): invalid relocation type 42

glibrename is a file where it has all glib original symbols defined and renamed symbols that i want to do.

Example file contents will be :

 glib_melloc test_glib_melloc
 glib_sym    test_glib_sym

Here is my objcopy version:

[kltest@il-kltest ~]$ objcopy --version
GNU objcopy version 2.20.51.0.2-5.36.el6 20100205
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
 This program has absolutely no warranty.

Anyone please help why i am hitting this issue, Any idea?

Naga
  • 59
  • 8

1 Answers1

1

Binutils 2.20 is just too old I'm afraid. (It's 9 years old.) Support for relocation type 42 was introduced about v2.25 /.26.

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
  • Mike, How could we change the Binutils version? Could you please brief info regarding same? It will try if it fixes my issue. – Naga May 29 '20 at 10:22
  • 1
    @Naga The package manager of your distro might provide a version >= 2.26. Otherwise you could attempt this `objcopy` op on a system with more recent binutils and take your chances with the resulting `libglib-2.0.a`. In principle you can always build binutils from [source](https://www.gnu.org/software/binutils/). But that is for experts. Binutils is intimately related with your OS + version and if you can't do what you need to do with binaries packaged by your distro I would strongly suspect something is misguided about what you're trying to do. – Mike Kinghan May 29 '20 at 10:51