Skip to content

Instantly share code, notes, and snippets.

@SKGleba
Created March 15, 2022 15:46
Show Gist options
  • Save SKGleba/d317f5f826aeb0a672a83ab792397040 to your computer and use it in GitHub Desktop.
Save SKGleba/d317f5f826aeb0a672a83ab792397040 to your computer and use it in GitHub Desktop.
bypass 24bit _start in mep gcc
%.S: %.c
$(CC) -S -o $@ $< $(CFLAGS)
%.o: %.S
mv $< $<.w
awk '{if ($$1 == "movu" && !($$3 ~ /^[0-9]/)) {$$1 = "or3"; $$4 = $$3; $$3 = $$2; printf("\tmovh %s 0x0004\n\t", $$2)}} 1' $<.w > $<
rm $<.w
$(CC) -c -o $@ $< $(CFLAGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment