diff --git a/scripts/generate_code.py b/scripts/generate_code.py index a6436f2a0a..9c427c3780 100644 --- a/scripts/generate_code.py +++ b/scripts/generate_code.py @@ -315,6 +315,25 @@ def _mako_info_hpp(path, namespace, tags, version, specs, meta): specs=specs, meta=meta) +""" +Entry-point: + generates linker version scripts +""" +def _mako_linker_scripts(path, ext, namespace, tags, version, specs, meta): + name = "adapter" + filename = f"{name}.{ext}.in" + fin = os.path.join(templates_dir, f"{filename}.mako") + fout = os.path.join(path, filename) + print("Generating %s..." % fout) + return util.makoWrite( + fin, fout, + name=name, + ver=version, + namespace=namespace, + tags=tags, + specs=specs, + meta=meta) + """ Entry-point: generates lib code @@ -349,6 +368,8 @@ def generate_adapters(path, section, namespace, tags, version, specs, meta): loc = 0 loc += _mako_null_adapter_cpp(dstpath, namespace, tags, version, specs, meta) + loc += _mako_linker_scripts(dstpath, "map", namespace, tags, version, specs, meta) + loc += _mako_linker_scripts(dstpath, "def", namespace, tags, version, specs, meta) print("Generated %s lines of code.\n"%loc) """ diff --git a/scripts/templates/adapter.def.in.mako b/scripts/templates/adapter.def.in.mako new file mode 100644 index 0000000000..7304682440 --- /dev/null +++ b/scripts/templates/adapter.def.in.mako @@ -0,0 +1,11 @@ +<%! +import re +from templates import helper as th +%><% + n=namespace +%>\ +LIBRARY @TARGET_LIBNAME@ +EXPORTS +%for tbl in th.get_pfntables(specs, meta, n, tags): + ${tbl['export']['name']} +%endfor diff --git a/scripts/templates/adapter.map.in.mako b/scripts/templates/adapter.map.in.mako new file mode 100644 index 0000000000..d03871f867 --- /dev/null +++ b/scripts/templates/adapter.map.in.mako @@ -0,0 +1,14 @@ +<%! +import re +from templates import helper as th +%><% + n=namespace +%>\ +@TARGET_LIBNAME@ { + global: +%for tbl in th.get_pfntables(specs, meta, n, tags): + ${tbl['export']['name']}; +%endfor + local: + *; +}; diff --git a/source/adapters/adapter.def.in b/source/adapters/adapter.def.in index bfe14a6a03..de0b4fa8ee 100644 --- a/source/adapters/adapter.def.in +++ b/source/adapters/adapter.def.in @@ -1,12 +1,11 @@ LIBRARY @TARGET_LIBNAME@ EXPORTS + urGetGlobalProcAddrTable urGetBindlessImagesExpProcAddrTable urGetCommandBufferExpProcAddrTable urGetContextProcAddrTable - urGetDeviceProcAddrTable urGetEnqueueProcAddrTable urGetEventProcAddrTable - urGetGlobalProcAddrTable urGetKernelProcAddrTable urGetMemProcAddrTable urGetPhysicalMemProcAddrTable @@ -14,7 +13,8 @@ EXPORTS urGetProgramProcAddrTable urGetQueueProcAddrTable urGetSamplerProcAddrTable + urGetUSMProcAddrTable urGetUSMExpProcAddrTable urGetUsmP2PExpProcAddrTable - urGetUSMProcAddrTable urGetVirtualMemProcAddrTable + urGetDeviceProcAddrTable diff --git a/source/adapters/adapter.map.in b/source/adapters/adapter.map.in index cbb5c6c4cb..4379e1f7de 100644 --- a/source/adapters/adapter.map.in +++ b/source/adapters/adapter.map.in @@ -1,12 +1,11 @@ @TARGET_LIBNAME@ { global: + urGetGlobalProcAddrTable; urGetBindlessImagesExpProcAddrTable; urGetCommandBufferExpProcAddrTable; urGetContextProcAddrTable; - urGetDeviceProcAddrTable; urGetEnqueueProcAddrTable; urGetEventProcAddrTable; - urGetGlobalProcAddrTable; urGetKernelProcAddrTable; urGetMemProcAddrTable; urGetPhysicalMemProcAddrTable; @@ -14,10 +13,11 @@ urGetProgramProcAddrTable; urGetQueueProcAddrTable; urGetSamplerProcAddrTable; + urGetUSMProcAddrTable; urGetUSMExpProcAddrTable; urGetUsmP2PExpProcAddrTable; - urGetUSMProcAddrTable; urGetVirtualMemProcAddrTable; + urGetDeviceProcAddrTable; local: *; };