Launchpad has imported 8 comments from the remote bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=16715.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2014-03-17T15:00:17+00:00 Giuseppe-dangelo wrote:

Created attachment 7474
testcase

The attached program changes the output from "true" to "false" when the
-Bsymbolic / -Bsymbolic-functions options are passed to GCC. This
happens on ARM -- on x86-64 output is always "true".

The program involves a comparison, within a shared library, of a PMF
defined inside the shared library itself with the same PMF passed by the
application.

Compile with:

 > g++ -fPIC -shared -Wall -o libshared.so -Wl,-Bsymbolic shared.cpp
 > g++ -fPIE -Wall -o main main.cpp -L. -lshared

(The long story is that Qt 5 is taking PMFs in its public API, and the
comparison failing inside of Qt shared libraries is breaking code on
ARM, as -Bsymbolic is set by default there.)

The bug has been acknowledged, and tentative patch has been kindly
provided by W. Newton here:

> https://sourceware.org/ml/binutils/2014-01/msg00172.html

but there hasn't been any activity from what I can see, so I'm opening
this bug report to keep track of the issue.

References:

> http://lists.linaro.org/pipermail/linaro-toolchain/2014-January/003942.html
> https://bugreports.qt-project.org/browse/QTBUG-36129

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/0

------------------------------------------------------------------------
On 2014-03-20T10:12:05+00:00 V-thomas-i wrote:

Created attachment 7483
C-only testcase

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/1

------------------------------------------------------------------------
On 2014-03-20T10:26:11+00:00 V-thomas-i wrote:

Attached a C-only testcase (forgot to rename the files from .cpp to .c,
but I don't think that matters). The testcase simply outputs the
function pointer of a function in a shared library, and one can see that
the address is not the same.

Compile with:
gcc -fPIC -shared -Wall -o libshared.so -Wl,-Bsymbolic shared.cpp
gcc -fPIE -Wall -o main main.cpp -L. -lshared

The output on my machine is:
# ./main 
0x8518
0x2ac595cc

The root of the problem seems to be that main gets the following undefined 
symbol:
   Num:    Value  Size Type    Bind   Vis      Ndx Name           
    14: 0000853c     0 FUNC    GLOBAL DEFAULT  UND testFunction()

This is a special hack - an undefined symbol that nevertheless has a value! See 
http://www.airs.com/blog/archives/42 for details on how that hack is supposed 
to work.
The idea is to use a different symbol value depending on the relocation type - 
a relocation for R_ARM_JUMP_SLOT should always resolve to the local PLT, but a 
relocation of type R_ARM_GLOB_DAT should use the symbol value defined in main. 
The problem is that libshared.so doesn't contain a R_ARM_GLOB_DAT relocation 
when taking the address of the function, but a R_ARM_RELATIVE relocation, and 
will therefore never resolve the function address to the value in main.
I guess this is a consequence of using -Bsymbolic - when taking the address of 
a function, it should still go through the GOT, with a R_ARM_GLOB_DAT 
relocation, despite -Bsymbolic being set.

Or at least that is what I think is the cause of the problem, I am by no
means a Linker export, I only recently started being interested in this
topic.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/2

------------------------------------------------------------------------
On 2014-03-20T10:44:58+00:00 V-thomas-i wrote:

Created attachment 7484
C-only testcase

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/3

------------------------------------------------------------------------
On 2014-03-20T10:53:46+00:00 V-thomas-i wrote:

Note that on x86-64, this works, but is *not* solved like the hacky
method that Ian Lance Taylor describes in his blog.

Instead of using an undefined symbol with an actual value in main, x86-64 will 
create a normal undefined symbol with a 0 value:
    12: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND testFunction

This works well: The relocations in libshared.so is a relative
relocation that resolves to the actual address of testFunction (not the
PLT stub), and the relocation in main is a R_X86_64_GLOB_DAT relocation
that resolves to the address of testFunction in libshared.so, and all
just works.

This is less hacky, and I think also the proposed patch from the mailing
list solves the problem this way.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/4

------------------------------------------------------------------------
On 2014-03-20T11:44:47+00:00 Cvs-commit wrote:

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  97323ad11305610185a0265392cabcd37510f50e (commit)
      from  e1f8f1b3af798e8af99bffdb695f74c6c916d150 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=97323ad11305610185a0265392cabcd37510f50e

commit 97323ad11305610185a0265392cabcd37510f50e
Author: Will Newton <will.new...@linaro.org>
Date:   Fri Jan 10 14:38:58 2014 +0000

    bfd/elf32-arm.c: Set st_value to zero for undefined symbols
    
    Unless pointer_equality_needed is set then set st_value to be zero
    for undefined symbols.
    
    bfd/ChangeLog:
    
    2014-03-20  Will Newton  <will.new...@linaro.org>
    
        PR ld/16715
        * elf32-arm.c (elf32_arm_check_relocs): Set
        pointer_equality_needed for absolute references within
        executable links.
        (elf32_arm_finish_dynamic_symbol): Set st_value to zero
        unless pointer_equality_needed is set.
    
    ld/testsuite/ChangeLog:
    
    2014-03-20  Will Newton  <will.new...@linaro.org>
    
        * ld-arm/ifunc-14.rd: Update symbol values.

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog                   |    9 +++++++++
 bfd/elf32-arm.c                 |    7 ++++++-
 ld/testsuite/ChangeLog          |    4 ++++
 ld/testsuite/ld-arm/ifunc-14.rd |    4 ++--
 4 files changed, 21 insertions(+), 3 deletions(-)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/5

------------------------------------------------------------------------
On 2014-03-20T21:37:05+00:00 Giuseppe-dangelo wrote:

Thanks to Will for merging the patch. I'm not closing this just yet as
we got reports of the same kind of breakage on PPC.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/6

------------------------------------------------------------------------
On 2022-11-24T04:24:09+00:00 Alan Modra wrote:

Fixed

Reply at:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1403758/comments/24


** Changed in: binutils
       Status: Unknown => Fix Released

** Changed in: binutils
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to qtbase-opensource-src in
Ubuntu.
https://bugs.launchpad.net/bugs/1403758

Title:
  Unity8 shows black screen with Qt 5.4.0

Status in binutils:
  Fix Released
Status in binutils package in Ubuntu:
  Fix Released
Status in gcc-defaults package in Ubuntu:
  Incomplete
Status in qtbase-opensource-src package in Ubuntu:
  Fix Released
Status in ubuntu-ui-toolkit package in Ubuntu:
  Invalid
Status in unity8 package in Ubuntu:
  Fix Released

Bug description:
  With bug #1403511 taken care of in Qt, apps do not anymore crash with
  Qt 5.4 and device does not anymore go into reboot loop. However,
  nothing is visible on the screen.

  It seems unity8, unity8-dash etc are all running. unity8.log attached

  Relevant upstream links referring GCC5 as the reason to require -fPIC:
  
http://code.qt.io/cgit/qt/qtbase.git/commit/?id=36d6eb721e7d5997ade75e289d4088dc48678d0d
  
http://code.qt.io/cgit/qt/qtbase.git/commit/?id=3eca75de67b3fd2c890715b30c7899cebc096fe9

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


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to