On Fri, Jan 24, 2020 at 1:10 PM 'Michael Stiller' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> playing around with tamago i noticed that if i compile with this command:
>
> GO_EXTLINK_ENABLED=0 CGO_ENABLED=0 GOOS=tamago GOARM=6 GOARCH=arm \
>   ${TAMAGO} build -ldflags "-v -T 0x00008000 -E _rt0_arm_tamago -R 0x1000" $@
>
> The generated (elf) binary has the following symbols:
>
> nm main | sort | head
> 00008000 T internal/cpu.Initialize
> 00008000 t runtime.text
> 00008144 T internal/cpu.processOptions
> 000087d4 T internal/cpu.indexByte
> 00008848 T type..hash.internal/cpu.CacheLinePad
> 00008858 T type..eq.internal/cpu.CacheLinePad
> 00008868 T type..hash.internal/cpu.arm
> 000088b0 T type..eq.internal/cpu.arm
> 000088ec T type..hash.internal/cpu.arm64
> 00008934 T type..eq.internal/cpu.arm64
>
> What determines and is this configurable that internal/cpu.Initialize gets 
> linked at 0x00008000?
>
> What i want to achieve is, that the -E entry symbol gets linked first at 
> 0x8000.

Nothing in particular determines that that symbol is a 0x8000.  The -T
option says that the text segment will start at 0x8000.  The Go linker
doesn't have any support for ordering the symbols in the text segment.
They just wind up being placed based on the order in which the linker
processes its inputs, which is unpredictable and subject to change.

The -E option sets the value stored in the ELF ehdr's e_entry field.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVboXnqCXEjO1HeN2hJnOneDismXFJzv7NahkrocSepSg%40mail.gmail.com.

Reply via email to