-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @PLT for PIC complication #10
Conversation
Thanks, @postwait. I would like to take some time to check it :D |
Thank you very much for your PR, @postwait :D I have just tested: $ gcc -c -fPIC -o acosw.o acosw.S
$ gcc -c -fPIC -o aco.o aco.c
$ gcc -shared -fPIC acosw.o aco.o -o libaco.so
$ gcc -L ${path} -Wall -o bench_so test_aco_benchmark.c -laco
$ ldd bench_so
linux-vdso.so.1 => (0x00007ffc37ffc000)
libaco.so => ${path}/libaco.so (0x00007f4badf41000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4bad959000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4badd26000)
$ gcc -g -O2 acosw.S aco.c -o bench_static test_aco_benchmark.c
$ ldd bench_static
linux-vdso.so.1 => (0x00007ffe1f666000)
libc.so.6 => /lib64/libc.so.6 (0x00007fcf454af000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf4587c000) And found that the speed of And the binary of libaco itself is very tiny (15k~). So, could you please explain why you want such support? |
Maybe this kind of support is fine, but there has to be a corresponding well-documented notice about such usage. |
If you build the acosw.S as part of a shared object (lib.so) to be linked into another executable, it will not build b/c those It will only be enabled (as required) when Out of curiosity, if you |
I have jus tested the |
Yes. But the binary of libaco itself is so tiny (15k~). So, does there exist some situation which needs such shared object? Why not just use the static linking instead? |
Alas, this is the penalty of shared libraries. So you're seeing a jump from 10ns switches to 14ns switches? That isn't too surprising. It's the cost of jumping through the procedure linkage table for |
In your tests you're compiling everything with -fPIC? Those changes to acosw.S should never play into the performance as those are just failure calls. I think we're just seeing the expected PLT penalty of having things like |
Yes, our
Yep... so, do you still want such support? Personally, I think it is better to just static link libaco to the application instead of dynamic loading by something like |
This is how I built the $ gcc -c -fPIC -o acosw.o acosw.S
$ gcc -c -fPIC -o aco.o aco.c
$ gcc -shared -fPIC acosw.o aco.o -o libaco.so
$ gcc -L ${path} -Wall -o bench_so test_aco_benchmark.c -laco
$ ldd bench_so
linux-vdso.so.1 => (0x00007ffc37ffc000)
libaco.so => ${path}/libaco.so (0x00007f4badf41000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4bad959000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4badd26000) Only aco.c and acosw.S are built with the |
Ok, I think it is fine to add such support. But still, a well-documented notice about the performance penalty of such usage is neccessary too. |
I think the support is required. I don't see another way to support an app (like ours) that dynamically loads libraries that implement features that need to call aco_yield and aco_resume. Do you see a way around this? Also, I see significantly less performance penalty than you see by adding |
I just tried the
Agree with you. This PR would be merged later. And a well-documented notice about the performance penalty of such usage would be added too. |
PR #10 by Theo Schlossnagle <theo.schlossnagle@circonus.com> Reviewed by Sen Han <00hnes@gmail.com>
Merged. Thank you very much, @postwait. |
No description provided.