test(C0.3): pin JIT shadowing — a #source unit's zlibCompileFlags loses to the process-loaded OS libz (xfail for C2.1)
This commit is contained in:
17
examples/1621-cimport-shadow-os-lib.sx
Normal file
17
examples/1621-cimport-shadow-os-lib.sx
Normal file
@@ -0,0 +1,17 @@
|
||||
// Pins the C2 gap (PLAN-C C0.3): a `#source` unit defining a symbol
|
||||
// that ALSO lives in an OS image already loaded into the compiler
|
||||
// process (libz, via libLLVM) loses under `sx run` — the JIT resolves
|
||||
// globally and the earlier-loaded OS copy wins. The unit's
|
||||
// zlibCompileFlags answers 0xDEADBEEF (3735928559); the OS one answers
|
||||
// real flag bits. After C2 (unit-first resolution) this prints true.
|
||||
#import "modules/std.sx";
|
||||
|
||||
zshadow :: #import c {
|
||||
#include "1621-cimport-shadow-os-lib/shadow.h";
|
||||
#source "1621-cimport-shadow-os-lib/shadow.c";
|
||||
};
|
||||
|
||||
main :: () -> i32 {
|
||||
print("from_unit: {}\n", zshadow.zlibCompileFlags() == 3735928559);
|
||||
0
|
||||
}
|
||||
1
examples/1621-cimport-shadow-os-lib/shadow.c
Normal file
1
examples/1621-cimport-shadow-os-lib/shadow.c
Normal file
@@ -0,0 +1 @@
|
||||
unsigned long zlibCompileFlags(void) { return 3735928559UL; }
|
||||
1
examples/1621-cimport-shadow-os-lib/shadow.h
Normal file
1
examples/1621-cimport-shadow-os-lib/shadow.h
Normal file
@@ -0,0 +1 @@
|
||||
unsigned long zlibCompileFlags(void);
|
||||
1
examples/expected/1621-cimport-shadow-os-lib.exit
Normal file
1
examples/expected/1621-cimport-shadow-os-lib.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
examples/expected/1621-cimport-shadow-os-lib.stderr
Normal file
1
examples/expected/1621-cimport-shadow-os-lib.stderr
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
examples/expected/1621-cimport-shadow-os-lib.stdout
Normal file
1
examples/expected/1621-cimport-shadow-os-lib.stdout
Normal file
@@ -0,0 +1 @@
|
||||
from_unit: false
|
||||
Reference in New Issue
Block a user