Replies: 3 comments 8 replies
-
@perry-ca is there a clang equivalent to -qDLL? Is there a clang option to avoid setting these |
Beta Was this translation helpful? Give feedback.
-
The working ld command with -v added:
Same command without the -bncal, this .so would be linked into some code that provided these symbols, so they aren't present when building the .so:
|
Beta Was this translation helpful? Give feedback.
-
What you are describing requires runtime linking. As far as I know we can't do that on z/OS. When a shared object is linked all of the symbols have to resolve to a symbol in a .o file or is imported from a known shared object. I haven't seen a way to defer symbol resolution until runtime. I'll check again to confirm. The --shared option is working as it is for other shared object builds. It may be better to drop the -u option. I'll explore that too. |
Beta Was this translation helpful? Give feedback.
-
I'm working on porting librdkafka using clang, and have run into a few challenges, this one is about building a shared library with clang.
One of the test Makefiles tries to build a shared library with the command and errors below:
re-running the clang command with -v shows the following /bin/ld command being executed, with -e, -O and -u flags that seem to be incorrect to produce a shared library:
"/bin/ld" -o interceptor_test.so.1 -b AMODE=64,LIST,DYNAM=DLL,MSGLEVEL=4,CASE=MIXED,REUS=RENT -e CELQSTRT -O CELQSTRT -u CELQMAIN -x interceptor_test.so.x -L~/zopen/prod/ncurses-6.3/lib -L../../src -L/Z25R03/usr/lpp/IBM/cnw/v1r1/openxl/bin/../lib/s390x-ibm-zos -bedit=no interceptor_test.o -lm -lncurses -lrdkafka -S //'CEE.SCEEBND2' -S //'SYS1.CSSLIB' //'CEE.SCEELIB(CELQS001)' //'CEE.SCEELIB(CELQS003)' /Z25R03/usr/lpp/IBM/cnw/v1r1/openxl/lib/clang/14.0.0/lib/s390x-ibm-zos/libclang_rt.builtins.a
Running that ld command separately, having removed the -e, -O and -u flags, and added the -bdyam=dll and -bncal flags finishes without error:
"/bin/ld" -o interceptor_test.so.1 -b AMODE=64,LIST,DYNAM=DLL,MSGLEVEL=4,CASE=MIXED,REUS=RENT -x interceptor_test.so.x -L~/zopen/prod/ncurses-6.3/lib -L../../src -L/Z25R03/usr/lpp/IBM/cnw/v1r1/openxl/bin/../lib/s390x-ibm-zos -bedit=no -bdynam=dll -bncal interceptor_test.o -lm -lncurses -lrdkafka -S "//'CEE.SCEEBND2'" -S "//'SYS1.CSSLIB'" "//'CEE.SCEELIB(CELQS001)'" "//'CEE.SCEELIB(CELQS003)'" /Z25R03/usr/lpp/IBM/cnw/v1r1/openxl/lib/clang/14.0.0/lib/s390x-ibm-zos/libclang_rt.builtins.a
I don't yet know if the .so that was produced is a good one, but the question here is how to get clang to invoke ld with what I currently believe is the correct set of flags?
Note: When I say I'm using clang, I'm actually using a script wrapper that runs "ibm-clang -m64" instead of "clang", I don't know if, how or why that would matter, but I wanted to mention it just in case it does.
Thanks,
Kelly
Beta Was this translation helpful? Give feedback.
All reactions