1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00

Ensure the we pass the correct symbol address to objcopy

If kernel.Kmain defines a nested function then a symbol like `github.com/achilleasa/gopher-os/kernel.Kmain.func1` will be generated. To make sure we always pick the `github.com/achilleasa/gopher-os/kernel.Kmain` symbol address we just need to add a `$` to the grep argument.
This commit is contained in:
Achilleas Anagnostopoulos 2017-04-01 07:09:49 +01:00 committed by GitHub
parent 46353b198d
commit d69c945019

View File

@ -52,7 +52,7 @@ go.o:
@# with slashes we create a global symbol alias for kernel.Kmain
@echo "[objcopy] creating global symbol alias 'kernel.Kmain' for 'github.com/achilleasa/gopher-os/kernel.Kmain' in go.o"
@objcopy \
--add-symbol kernel.Kmain=.text:0x`nm $(BUILD_DIR)/go.o | grep "kernel.Kmain" | cut -d' ' -f1` \
--add-symbol kernel.Kmain=.text:0x`nm $(BUILD_DIR)/go.o | grep "kernel.Kmain$$" | cut -d' ' -f1` \
$(BUILD_DIR)/go.o $(BUILD_DIR)/go.o
binutils_version_check: