Closed GoogleCodeExporter closed 9 years ago
Bypass to Trent. He is responsible for this issue.
Original comment by LubaTang
on 18 Feb 2013 at 2:35
1. Add ELFReader<64, true> to read 64-bit ELF files (in ELFReader.h)
-- please update to (or after) commit 82aacb to see it
2. Move out ELFReaderIf from ELFReader.h to a separate file (ELFReaderIf.h)
3. Add unitest cases in ELFReaderTest.h
Original comment by lo.chenk...@gmail.com
on 20 Feb 2013 at 10:46
It doesn't work right:
[hjl@gnu-6 test-1]$ cat lib.c
int
foo ()
{
return 300;
}
[hjl@gnu-6 test-1]$ make libfoo.so
gcc -c -O2 -m64 -fno-asynchronous-unwind-tables -fPIC -o lib.o lib.c
./ld.mcld -mtriple=x86_64-linux -filetype=dso -o libfoo.so lib.o
ld.mcld:
/export/gnu/import/git/google/mclinker/debug/../lib/Target/ELFDynamic.cpp:80:
void mcld::ELFDynamic::reserveOne(uint64_t): Assertion `__null !=
m_pEntryFactory' failed.
make: *** [libfoo.so] Aborted
[hjl@gnu-6 test-1]$
Original comment by hjl.to...@gmail.com
on 20 Feb 2013 at 8:57
Original comment by pete.c...@gmail.com
on 21 Feb 2013 at 1:54
Hi HJ,
I added 64-bit elf dynamic support in Rev. 506d95e6df13, and your example can
be linked with that.
Original comment by pete.c...@gmail.com
on 21 Feb 2013 at 3:19
64-bit dynamic relocations aren't generated properly:
[hjl@gnu-6 test-2]$ cat lib.c
int bar1 = 200;
int bar2 = 300;
int
foo ()
{
return bar2 / bar1;
}
void *
foo_p ()
{
return foo;
}
[hjl@gnu-6 test-2]$ make libfoo.so
gcc -c -O2 -m64 -fno-asynchronous-unwind-tables -fPIC -o lib.o lib.c
./ld.mcld -mtriple=x86_64-pc-linux-gnu -filetype=dso -o libfoo.so lib.o
[hjl@gnu-6 test-2]$ readelf -r libfoo.so
Relocation section '.rela.dyn' at offset 0x288 contains 3 entries:
Offset Info Type Sym. Value Sym. Name + Addend
0606000010b0 10b800000000 R_X86_64_NONE bad symbol index: 000010b8
0506000010c0 000000000000 R_X86_64_NONE 0
000000000000 000000000000 R_X86_64_NONE 0
[hjl@gnu-6 test-2]$
Original comment by hjl.to...@gmail.com
on 21 Feb 2013 at 8:08
ELFWriter::emitRel and ELFWriter::emitRela are hard-coded to 32-bit.
Original comment by hjl.to...@gmail.com
on 22 Feb 2013 at 7:23
Luba just added 64-bit relocation support in Rev. 37c9756c42b3.
Original comment by pete.c...@gmail.com
on 25 Feb 2013 at 10:18
Archive reader doesn't support 64-bit ELF:
[hjl@gnu-6 test-10b]$ cat foo.c
int foo[20];
extern void bar (int);
int
_start ()
{
bar (12);
return 0;
}
[hjl@gnu-6 test-10b]$ cat reloc.c
extern int foo[];
int
bar (int i)
{
return foo[i];
}
[hjl@gnu-6 test-10b]$ make
gcc -O2 -c -o foo.o foo.c
./ld.mcld -mtriple=x86_64-linux -filetype=exe -o foo foo.o libreloc.a
make: *** [foo] Segmentation fault
[hjl@gnu-6 test-10b]$
Original comment by hjl.to...@gmail.com
on 25 Feb 2013 at 6:17
To build libreloc.a:
gcc -O2 -c -o reloc.o reloc.c
ar rv libreloc.a reloc.o
Original comment by hjl.to...@gmail.com
on 25 Feb 2013 at 6:19
I checked in commit 8e40b3dfbeba7410f10419f209fd5cf5c4940eaa
to add ELFReader<64, true> to ELFDynObjReader.
Original comment by hjl.to...@gmail.com
on 25 Feb 2013 at 6:41
So looks like it's not the bug in archive reader, but no 64-bit elf reader in
ELFDynObjReader.
Original comment by pete.c...@gmail.com
on 26 Feb 2013 at 1:39
Is there anything left for this specific bug?
Original comment by joerg.sonnenberger@googlemail.com
on 29 Mar 2013 at 3:04
Closing, x86-64 has a few issues left in the NetBSD tries, but nothing generic
in the 64bit ELF support AFAICT.
Original comment by joerg.sonnenberger@googlemail.com
on 9 Aug 2013 at 7:02
Original issue reported on code.google.com by
hjl.to...@gmail.com
on 12 Feb 2013 at 12:19