ref: 666b9f8f7b0c17696139b3a42c51ad39f1bfa5d8
parent: 7deb8d3e8ae95a5e669cb8b7531aa133486e09c9
author: ISSOtm <[email protected]>
date: Tue Mar 24 06:52:45 EDT 2020
Add tests for purging symbols
--- /dev/null
+++ b/test/asm/purge-refs.asm
@@ -1,0 +1,13 @@
+
+SECTION "floating purging", ROM0
+
+Floating:
+ db Floating
+ PURGE Floating ; This used to cause a use-after-free
+ ; To increase the chances of the data being re-allocated, it's not last
+
+SECTION "fixed purging", ROM0[0]
+
+Fixed:
+ db Fixed
+ PURGE Fixed ; Can work, it's a constant
--- /dev/null
+++ b/test/asm/purge-refs.err
@@ -1,0 +1,3 @@
+ERROR: purge-refs.asm(6):
+ Symbol "Floating" is referenced and thus cannot be purged
+error: Assembly aborted (1 errors)!
--- /dev/null
+++ b/test/asm/purge.asm
@@ -1,0 +1,13 @@
+
+SECTION "purging", ROM0
+
+Label:
+ PURGE Label
+Label:
+
+ db Referenced
+ PURGE Referenced ; Should fail
+
+Exported::
+ PURGE Exported
+Exported::
--- /dev/null
+++ b/test/asm/purge.err
@@ -1,0 +1,3 @@
+ERROR: purge.asm(9):
+ Symbol "Referenced" is referenced and thus cannot be purged
+error: Assembly aborted (1 errors)!