diff --git a/lang/b/lib/b.h b/lang/b/lib/b.h new file mode 100644 index 000000000..123eabc58 --- /dev/null +++ b/lang/b/lib/b.h @@ -0,0 +1,19 @@ +#ifndef B_H +#define B_H + +#include +#include + +#if EM_PSIZE == 2 +#define SHIFT 1 +#elif EM_PSIZE == 4 +#define SHIFT 2 +#elif EM_PSIZE == 8 +#define SHIFT 3 +#else +#error Unsupported EM_PSIZE +#endif + +extern FILE* output_unit; + +#endif diff --git a/lang/b/lib/build.lua b/lang/b/lib/build.lua new file mode 100644 index 000000000..a45ab78a0 --- /dev/null +++ b/lang/b/lib/build.lua @@ -0,0 +1,27 @@ +include("plat/build.lua") + +for _, plat in ipairs(vars.plats) do + acklibrary { + name = "lib_"..plat, + srcs = { + "./*.c", + "./*.e", + }, + hdrs = {}, -- must be empty + deps = { + "./*.h", + "h+emheaders", + "lang/cem/libcc.ansi/headers+headers", + "plat/"..plat.."/include+headers", + }, + vars = { plat = plat } + } + + installable { + name = "pkg_"..plat, + map = { + ["$(PLATIND)/"..plat.."/libb.a"] = "+lib_"..plat, + } + } +end + diff --git a/lang/b/lib/main.c b/lang/b/lib/main.c new file mode 100644 index 000000000..1d18a800e --- /dev/null +++ b/lang/b/lib/main.c @@ -0,0 +1,59 @@ +#include "b.h" + +extern uintptr_t* bsymb_patch_table[]; +extern intptr_t i_main(intptr_t argc, const char* argv[]); + +FILE* output_unit; + +static intptr_t i_char(intptr_t s, intptr_t n) +{ + const char* p = (const char*)(s<>= SHIFT; + } +} + +int main(int argc, const char* argv[]) +{ + patch_addresses(bsymb_patch_table); + patch_addresses(lib_patch_table); + output_unit = stdout; + return i_main(argc, NULL); +} \ No newline at end of file diff --git a/plat/build.lua b/plat/build.lua index 85ba61bc9..a8d1684bb 100644 --- a/plat/build.lua +++ b/plat/build.lua @@ -104,6 +104,7 @@ definerule("build_plat_libs", "lang/cem/libcc.ansi+pkg_"..e.plat, "lang/m2/libm2+pkg_"..e.plat, "lang/pc/libpc+pkg_"..e.plat, + "lang/b/lib+pkg_"..e.plat, ["$(PLATIND)/"..e.plat.."/libem.a"] = "mach/"..e.arch.."/libem+lib_"..e.plat, ["$(PLATIND)/"..e.plat.."/libend.a"] = "mach/"..e.arch.."/libend+lib_"..e.plat, }