Message ID | 20190923222403.22956-1-ndesaulniers@google.com |
---|---|
State | Superseded |
Headers | show |
Series | x86, realmode: explicitly set ENTRY in linker script | expand |
On Tue, Sep 24, 2019 at 12:24 AM 'Nick Desaulniers' via Clang Built Linux <clang-built-linux@googlegroups.com> wrote: > > Linking with ld.lld via $ make LD=ld.lld produces the warning: > ld.lld: warning: cannot find entry symbol _start; defaulting to 0x1000 > > Linking with ld.bfd shows the default entry is 0x1000: > $ readelf -h arch/x86/realmode/rm/realmode.elf | grep Entry > Entry point address: 0x1000 > > While ld.lld is being pedantic, just set the entry point explicitly, > instead of depending on the implicit default. > > Link: https://github.com/ClangBuiltLinux/linux/issues/216 Reported-by: Sedat Dilek <sedat.dilek@gmail.com> (seen on my first steps when linking with LLD on x86-64) > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> > --- > arch/x86/realmode/rm/realmode.lds.S | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/realmode/rm/realmode.lds.S b/arch/x86/realmode/rm/realmode.lds.S > index 3bb980800c58..2034f5f79bff 100644 > --- a/arch/x86/realmode/rm/realmode.lds.S > +++ b/arch/x86/realmode/rm/realmode.lds.S > @@ -11,6 +11,7 @@ > > OUTPUT_FORMAT("elf32-i386") > OUTPUT_ARCH(i386) > +ENTRY(0x1000) > > SECTIONS > { > -- > 2.23.0.351.gc4317032e6-goog > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190923222403.22956-1-ndesaulniers%40google.com.
On Mon, Sep 23, 2019 at 03:24:02PM -0700, 'Nick Desaulniers' via Clang Built Linux wrote: > Linking with ld.lld via $ make LD=ld.lld produces the warning: > ld.lld: warning: cannot find entry symbol _start; defaulting to 0x1000 > > Linking with ld.bfd shows the default entry is 0x1000: > $ readelf -h arch/x86/realmode/rm/realmode.elf | grep Entry > Entry point address: 0x1000 > > While ld.lld is being pedantic, just set the entry point explicitly, > instead of depending on the implicit default. > > Link: https://github.com/ClangBuiltLinux/linux/issues/216 > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> > --- > arch/x86/realmode/rm/realmode.lds.S | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/realmode/rm/realmode.lds.S b/arch/x86/realmode/rm/realmode.lds.S > index 3bb980800c58..2034f5f79bff 100644 > --- a/arch/x86/realmode/rm/realmode.lds.S > +++ b/arch/x86/realmode/rm/realmode.lds.S > @@ -11,6 +11,7 @@ > > OUTPUT_FORMAT("elf32-i386") > OUTPUT_ARCH(i386) > +ENTRY(0x1000) > > SECTIONS > { > -- > 2.23.0.351.gc4317032e6-goog > This appears to break ld.bfd? ld:arch/x86/realmode/rm/realmode.lds:131: syntax error make[5]: *** [../arch/x86/realmode/rm/Makefile:54: arch/x86/realmode/rm/realmode.elf] Error 1 make[4]: *** [../arch/x86/realmode/Makefile:20: arch/x86/realmode/rm/realmode.bin] Error 2 make[3]: *** [../scripts/Makefile.build:509: arch/x86/realmode] Error 2 Cheers, Nathan
On Tue, Sep 24, 2019 at 11:24 AM Nathan Chancellor <natechancellor@gmail.com> wrote: > > On Mon, Sep 23, 2019 at 03:24:02PM -0700, 'Nick Desaulniers' via Clang Built Linux wrote: > > Linking with ld.lld via $ make LD=ld.lld produces the warning: > > ld.lld: warning: cannot find entry symbol _start; defaulting to 0x1000 > > > > Linking with ld.bfd shows the default entry is 0x1000: > > $ readelf -h arch/x86/realmode/rm/realmode.elf | grep Entry > > Entry point address: 0x1000 > > > > While ld.lld is being pedantic, just set the entry point explicitly, > > instead of depending on the implicit default. > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/216 > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> > > --- > > arch/x86/realmode/rm/realmode.lds.S | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/arch/x86/realmode/rm/realmode.lds.S b/arch/x86/realmode/rm/realmode.lds.S > > index 3bb980800c58..2034f5f79bff 100644 > > --- a/arch/x86/realmode/rm/realmode.lds.S > > +++ b/arch/x86/realmode/rm/realmode.lds.S > > @@ -11,6 +11,7 @@ > > > > OUTPUT_FORMAT("elf32-i386") > > OUTPUT_ARCH(i386) > > +ENTRY(0x1000) > > > > SECTIONS > > { > > -- > > 2.23.0.351.gc4317032e6-goog > > > > This appears to break ld.bfd? > > ld:arch/x86/realmode/rm/realmode.lds:131: syntax error > make[5]: *** [../arch/x86/realmode/rm/Makefile:54: arch/x86/realmode/rm/realmode.elf] Error 1 > make[4]: *** [../arch/x86/realmode/Makefile:20: arch/x86/realmode/rm/realmode.bin] Error 2 > make[3]: *** [../scripts/Makefile.build:509: arch/x86/realmode] Error 2 Thanks for testing. Strange, it seems that ld.bfd doesn't like it as an ENTRY in the linker script, but will accept `-e <addr>`. Not sure if that's a bug in ld.bfd, or if ld.lld should error as well? https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/simple-commands.html v2 inbound. -- Thanks, ~Nick Desaulniers
diff --git a/arch/x86/realmode/rm/realmode.lds.S b/arch/x86/realmode/rm/realmode.lds.S index 3bb980800c58..2034f5f79bff 100644 --- a/arch/x86/realmode/rm/realmode.lds.S +++ b/arch/x86/realmode/rm/realmode.lds.S @@ -11,6 +11,7 @@ OUTPUT_FORMAT("elf32-i386") OUTPUT_ARCH(i386) +ENTRY(0x1000) SECTIONS {
Linking with ld.lld via $ make LD=ld.lld produces the warning: ld.lld: warning: cannot find entry symbol _start; defaulting to 0x1000 Linking with ld.bfd shows the default entry is 0x1000: $ readelf -h arch/x86/realmode/rm/realmode.elf | grep Entry Entry point address: 0x1000 While ld.lld is being pedantic, just set the entry point explicitly, instead of depending on the implicit default. Link: https://github.com/ClangBuiltLinux/linux/issues/216 Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> --- arch/x86/realmode/rm/realmode.lds.S | 1 + 1 file changed, 1 insertion(+) -- 2.23.0.351.gc4317032e6-goog