** Description changed:

- Go shared libraries depend on -Bsymbolic-functions working, which
- unfortunately doesn't in the version of binutils on trusty. The fix is
- in binutils-2_24-branch: https://sourceware.org/git/?p=binutils-
- gdb.git;a=commit;h=cd3813a8c9e59ccba0c42f5e3664465428e0e89c so could
- this be uploaded to trusty please? (I guess I should make this into a
- formal SRU request...)
+ There is a bug in the version ld.bfd in trusty on arm64, where even if
+ you pass -Bsymbolic-functions to ld, function pointer values are still
+ subject to interposition by other shared objects. This was fixed and
+ backported to the binutils-2_24 branch in January 2015.
+ 
+ [Impact]
+ Shared libraries for Go depend on -Bsymbolic-functions working
+ properly and while it's unlikely that we'll ever support a version of
+ Go on trusty that supports shared libraries, the arm64 builders for
+ Go's build dashboard are trusty machines and so I can't run the shared
+ library tests by default until this is fixed in trusty.
+ 
+ It's also extremely confusing to debug the problems this causes.
+ 
+ The bug existed on 32-bit ARM too, but there is a workaround: use gold
+ instead (which does not have this bug). That doesn't apply to arm64 as
+ there is no arm64 gold in trusty.
+ 
+ [Test Case]
+ 
+ $ cat shared.h
+ typedef int (*intfunc)(void);
+ int interpos(void);
+ intfunc getintfunc(void);
+ $ cat shared.c
+ #include <stdio.h>
+ #include "shared.h"
+ 
+ int interpos(void) {
+         return 0;
+ }
+ 
+ intfunc intfuncs[] = { interpos };
+ 
+ intfunc
+ getintfunc(void) {
+         return intfuncs[0];
+ }
+ 
+ void
+ callinterpos(void) {
+         printf("calling interpos directly says %d\n", interpos());
+ }
+ $ cat main.c
+ #include <stdio.h>
+ #include "shared.h"
+ 
+ int interpos(void) {
+         return 1;
+ }
+ 
+ int main(int argc, char** argv) {
+         callinterpos();
+         printf("calling interpos via pointer says %d\n", getintfunc()());
+ }
+ 
+ $ gcc -shared -Wl,-Bsymbolic-functions -o libshared.so shared.c
+ $ gcc -o main main.c ./libshared.so
+ $ ./main
+ calling interpos directly says 0
+ calling interpos via pointer says 1
+ 
+ The two values printed should be the same.
+ 
+ [Regression Potential]
+ It is ever so slightly possible that some package depends on the
+ broken behaviour, but that seems pretty unlikely given that this
+ behaviour does not occur on intel platforms.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1490352

Title:
  please backport aarch64 -Bsymbolic-functions fix to trusty

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1490352/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to