[lld] r247073 - [lld][elf2] Fix hard coded entry address.
Rafael EspĂndola via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 14:36:08 PDT 2015
Reverted as it broke check-lld.
In addition to Rui's suggestions, please also update one of the tests
to check the address of the _start symbol to show that it matches the
entry value.
Cheers,
Rafael
On 8 September 2015 at 17:11, Michael J. Spencer via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: mspencer
> Date: Tue Sep 8 16:11:25 2015
> New Revision: 247073
>
> URL: http://llvm.org/viewvc/llvm-project?rev=247073&view=rev
> Log:
> [lld][elf2] Fix hard coded entry address.
>
> Modified:
> lld/trunk/ELF/Writer.cpp
> lld/trunk/test/elf2/basic.s
> lld/trunk/test/elf2/basic32.s
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=247073&r1=247072&r2=247073&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Tue Sep 8 16:11:25 2015
> @@ -576,7 +576,11 @@ template <class ELFT> void Writer<ELFT>:
> 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>);
>
> Modified: lld/trunk/test/elf2/basic.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic.s?rev=247073&r1=247072&r2=247073&view=diff
> ==============================================================================
> --- lld/trunk/test/elf2/basic.s (original)
> +++ lld/trunk/test/elf2/basic.s Tue Sep 8 16:11:25 2015
> @@ -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)
>
> Modified: lld/trunk/test/elf2/basic32.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/basic32.s?rev=247073&r1=247072&r2=247073&view=diff
> ==============================================================================
> --- lld/trunk/test/elf2/basic32.s (original)
> +++ lld/trunk/test/elf2/basic32.s Tue Sep 8 16:11:25 2015
> @@ -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)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list