This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mon, May 29, 2006 at 10:33:18AM -0400, Andrew Cagney wrote:Definitely agree, we can think of the use of opcodes as an interim solution.
Yao Qi wrote:Luckily, 'bfd_getb32' and 'bfd_getl32' in bfd/libbfd.c are simple. I
Rather than drag in bfd, would it be possible to stub these methods?This patch fixes PR2698, where frysk could not be built on ppc64, since libopcode not could find 'bfd_getb32' and 'bfd_getl32'.
libopcodes has some external functions that are provided by libbfd on
ppc64,
[qiyao@plinuxt18 build-frysk-qiyao]$ readelf -s /usr/lib64/libopcodes-2.16.91.0.6.so | grep bfd
90: 00000000 0 NOTYPE GLOBAL DEFAULT UND bfd_get_arch
100: 00000000 0 NOTYPE GLOBAL DEFAULT UND bfd_getb32
122: 00000000 0 NOTYPE GLOBAL DEFAULT UND bfd_getl32
127: 00000000 0 NOTYPE GLOBAL DEFAULT UND bfd_get_mach
only copy the definition of these two functions to frysk/frysk-imports/util/elf/libbfd_get.c, compile it to a shared object,
and linked the shared object with fryski as follows,
[qiyao@plinuxt18 frysk-imports]$ gcc -m64
../../frysk/frysk-imports/util/elf/libbfd_get.c -c -o libbfd_get.o
[qiyao@plinuxt18 frysk-imports]$ gcc -m64 -g -O libbfd_get.o -shared -o
libbfd_get.so [qiyao@plinuxt18 frysk-imports]$ gcj -m64
-I../../frysk/frysk-imports -I. -Ijargs.jar -Ijunit.jar -Werror -Wall -fPIC
-g -O -o fryski -lgij -Wl,-rpath,./:/home/qiyao/build-frysk-5-23/frysk-imports
-L./ -lfrysk-imports -L./ -lfrysk-jargs -L./ -lfrysk-junit
-Lelfutils/libelf/ -lelf -Lelfutils/libdw/ -ldw
-Lelfutils/libdwfl/ -ldwfl -lopcodes libfrysk-imports.so
libfrysk-jargs.so libfrysk-junit.so libfrysk-imports.a libfrysk-jargs.a
libfrysk-junit.a elfutils/libelf/libelf.a elfutils/libdw/libdw.a
elfutils/libdwfl/libdwfl.a -lopcodes -L. -lbfd_get
^^^^^^^^^^^^^
I tried this both on i386 and ppc64, and errors are removed. Here is libbfd_get.c fro your reference,
unsigned long bfd_getb32 (const void *p) { const char *addr = p;
unsigned long v;
v = (unsigned long) addr[0] << 24;
v |= (unsigned long) addr[1] << 16;
v |= (unsigned long) addr[2] << 8;
v |= (unsigned long) addr[3];
return v;
}
unsigned long
bfd_getl32 (const void *p)
{
const char *addr = p;
unsigned long v;
v = (unsigned long) addr[0];
v |= (unsigned long) addr[1] << 8;
v |= (unsigned long) addr[2] << 16;
v |= (unsigned long) addr[3] << 24;
return v;
}
Actually, I am not sure whether we could solve the problem in this way
or not. In a long run, if the functionality of libopcode could be integrated into ElfUtils, frysk do not need to be linked with
libopcode. That would be better!
Any comments on this? Thanks in advance!I'll integrate something equivalent.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |