~rabbits/public-inbox

Add mac native rom.s v1 PROPOSED

Kyle Perik: 1
 Add mac native rom.s

 2 files changed, 16 insertions(+), 3 deletions(-)
What happens if you leave it out completely?
(gcc seems to use text segment here by default, without .section for me)

What is the error you are getting with .rodata here? or is it about the symbol underscore?

saper
Looks like as you mentioned, leaving out that line works.

The error I was getting was this when attempting `make run`:

```
src/rom.s:1:19: error: unexpected token in '.section' directive
.section ".rodata"
                  ^
make: *** [build/pdex.dylib] Error 1
```

Otherwise the only other change is adding underscores because of this error:

```
ld: Undefined symbols:
  _uxn_rom, referenced from:
      _uxn_init in main-c9e930.o
      _debug in main-c9e930.o
      _debug in main-c9e930.o
      _debug in main-c9e930.o
      _debug in main-c9e930.o
      _deo_system in main-c9e930.o
  _uxn_rom_size, referenced from:
      _uxn_init in main-c9e930.o
      _debug in main-c9e930.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

Do you think there's a way to avoid a different .s file? I'm a C/ASM
novice so forgive my ignorance
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rabbits/public-inbox/patches/47983/mbox | git am -3
Learn more about email & git

[PATCH] Add mac native rom.s Export this patch

diff --git a/Makefile b/Makefile
index 0cf69ce..e416137 100755
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,10 @@ STACK_SIZE  := 61800
LUA_DIR     := Source
SRC_DIR     := src
BUILD_DIR   := build
SRC_MAIN    := $(SRC_DIR)/main.c $(SRC_DIR)/rom.s
SRC			:= $(SRC_MAIN) $(SRC_SDK)
ROM_ASM     := $(SRC_DIR)/rom.s
ROM_ASM_MAC := $(SRC_DIR)/rom_mac.s
SRC_MAIN    := $(SRC_DIR)/main.c
SRC         := $(SRC_MAIN) $(SRC_SDK) $(ROM_ASM)
UXN_ROM     := roms/dvd.rom
ROM_FILE    := $(BUILD_DIR)/uxn.rom
ROM_OBJ     := $(BUILD_DIR)/rom.o
@@ -69,6 +71,7 @@ ifeq ($(DETECTED_OS), Linux)
    DYLIB_FLAGS = -shared -fPIC
    DYLIB_EXT   = so
    PDCFLAGS    = -k -sdkpath $(SDK)
    SRC_NATIVE  = $(SRC)
endif
ifeq ($(DETECTED_OS), Darwin)
    CLANGFLAGS  = -g
@@ -76,6 +79,7 @@ ifeq ($(DETECTED_OS), Darwin)
    DYLIB_FLAGS = -dynamiclib -rdynamic
    DYLIB_EXT   = dylib
    PDCFLAGS    = -k
    SRC_NATIVE  = $(SRC_MAIN) $(SRC_SDK) $(ROM_ASM_MAC)
endif

# Setup debug/release builds.
@@ -131,5 +135,5 @@ simulator: $(BUILD_DIR)/pdex.${DYLIB_EXT} | $(BUILD_DIR)
$(BUILD_DIR)/pdex.${DYLIB_EXT}: $(WATCH_SRC) $(ROM_FILE)| $(BUILD_DIR)
	cp $(UXN_ROM) $(ROM_FILE)
	$(SIMCOMPILER) $(DYLIB_FLAGS) -lm -DTARGET_SIMULATOR=1 -DTARGET_EXTENSION=1\
		$(INC_FLAGS) -o $(BUILD_DIR)/pdex.${DYLIB_EXT} $(SRC)
		$(INC_FLAGS) -o $(BUILD_DIR)/pdex.${DYLIB_EXT} $(SRC_NATIVE)
	rm $(ROM_FILE)
diff --git a/src/rom_mac.s b/src/rom_mac.s
new file mode 100644
index 0000000..af0f0f1
--- /dev/null
+++ b/src/rom_mac.s
@@ -0,0 +1,9 @@
.section __TEXT,__text

.balign 4
.global _uxn_rom
_uxn_rom:
.incbin "build/uxn.rom"

.global _uxn_rom_size
.set _uxn_rom_size, . - _uxn_rom
-- 
2.39.3 (Apple Git-145)
This is for uxn-playdate, it enables running games in the playdate
simulator on MacOS. Turns out the expected assembly format is a bit
different.