forked from OSchip/llvm-project
[lld][elf2] Fix hard coded entry address.
llvm-svn: 247073
This commit is contained in:
parent
0127d80986
commit
8be15899b4
|
@ -576,7 +576,11 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
|
|||
auto &FirstObj = cast<ObjectFile<ELFT>>(*Symtab.getFirstELF());
|
||||
EHdr->e_machine = FirstObj.getEMachine();
|
||||
EHdr->e_version = EV_CURRENT;
|
||||
EHdr->e_entry = 0x401000;
|
||||
|
||||
llvm::DenseMap<StringRef, Symbol *>::const_iterator Entry =
|
||||
Symtab.getSymbols().find("_start");
|
||||
|
||||
EHdr->e_entry = getSymVA(cast<DefinedRegular<ELFT>>(Entry->second->Body));
|
||||
EHdr->e_phoff = sizeof(Elf_Ehdr_Impl<ELFT>);
|
||||
EHdr->e_shoff = SectionHeaderOff;
|
||||
EHdr->e_ehsize = sizeof(Elf_Ehdr_Impl<ELFT>);
|
||||
|
|
|
@ -23,7 +23,7 @@ _start:
|
|||
# CHECK-NEXT: Type: Executable (0x2)
|
||||
# CHECK-NEXT: Machine: EM_X86_64 (0x3E)
|
||||
# CHECK-NEXT: Version: 1
|
||||
# CHECK-NEXT: Entry: 0x401000
|
||||
# CHECK-NEXT: Entry: 0x1000
|
||||
# CHECK-NEXT: ProgramHeaderOffset: 0x40
|
||||
# CHECK-NEXT: SectionHeaderOffset: 0x1070
|
||||
# CHECK-NEXT: Flags [ (0x0)
|
||||
|
|
|
@ -23,7 +23,7 @@ _start:
|
|||
# CHECK-NEXT: Type: Executable (0x2)
|
||||
# CHECK-NEXT: Machine: EM_386 (0x3)
|
||||
# CHECK-NEXT: Version: 1
|
||||
# CHECK-NEXT: Entry: 0x401000
|
||||
# CHECK-NEXT: Entry: 0x1000
|
||||
# CHECK-NEXT: ProgramHeaderOffset: 0x34
|
||||
# CHECK-NEXT: SectionHeaderOffset: 0x1058
|
||||
# CHECK-NEXT: Flags [ (0x0)
|
||||
|
|
Loading…
Reference in New Issue