Bug 175442

Summary: visibility handling causes bad jump generation
Product: [Fedora] Fedora Reporter: Ulrich Drepper <drepper>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: ajschult784, bkoz, caillon, dbaron, dravet, dwalsh, gajownik, jason, jwalden+brc, kengert, rdieter, rth
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-29 09:31:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 150223, 175275    
Attachments:
Description Flags
This test fails only with gcc 4.0.2.
none
Test case with implicit call generation
none
testcase with implicit call generation and no #includes
none
testcase with implicit call generation and no #includes none

Description Ulrich Drepper 2005-12-10 18:28:10 UTC
Description of problem:

I was looking into why firefox/thunderbird/mozilla have so many text
relocations.  Both on FC4 and devel.  It turns out the compiler is buggy when it
comes to implicitly generated calls and visibility.  With gcc 4.0.2-3 the
problem is even worse since also ordinary calls are affected.


Version-Release number of selected component (if applicable):
gcc-4.0.2-3
gcc-4.1.0-0.6

How reproducible:
always

Steps to Reproduce:
I'll attach two test cases:
1.compile with gcc -c -fpic -O2 -fno-builtin <FILE>.c
2.readelf -r <FILE>.o | fgrep memcpy
3.
  
Actual results:
  0x000000XX  386_PC32             0000000000  memcpy


Expected results:
  0x000000XX  386_PLT32            0000000000  memcpy


Additional info:

Comment 1 Ulrich Drepper 2005-12-10 18:28:10 UTC
Created attachment 122100 [details]
This test fails only with gcc 4.0.2.

Comment 2 Ulrich Drepper 2005-12-10 18:30:13 UTC
Created attachment 122101 [details]
Test case with implicit call generation

This test fails with gcc 4.0.2 and gcc 4.1.0.

Comment 3 Ulrich Drepper 2005-12-10 18:34:04 UTC
Argh, I meant use

  gcc -c -fpic -Os -fno-builtin <FILE>.c


Note: -Os, not -O2.

Comment 4 Jakub Jelinek 2005-12-12 10:06:27 UTC
This is upstream PR20297 I'd say, but there are many other unresolved GCC
problems with visibility (mainly in C++ land).
The most important ones are I think
PR20297, PR19664, PR21581 and PR21764
but I've added external references to other relevant upstream bugreports.

I think this is something that should be resolved soon, for FC5/GCC 4.2
and can be backported to selected compilers, because without resolving at least
the more important bugs applications that use #pragma GCC visibility
or -fvisibility=... (there are many now), if they work, work often by pure luck.

For PR20297, Roger's
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00321.html
contains some good comments about it.

Comment 5 Benjamin Kosnik 2005-12-12 17:23:18 UTC
Agreed that this is a major problem. However, want weak versioning patches
finished first.... which also impact linkage for FC5. 

Then I'll start paying  more attention to the vis stuff.

Comment 6 Christopher Aillon 2006-01-13 20:14:55 UTC
Would be nice to get this for FC5 for the big apps that use it (firefox,
thunderbird, mozilla, etc).  Adding to FC5Target

Comment 7 David Baron 2006-03-21 08:25:18 UTC
Created attachment 126379 [details]
testcase with implicit call generation and no #includes

Since I just spent a good bit of time simplifying this before drepper pointed
me to this bug, I may as well attach it; it has the advantage of not having any
#includes, since none are needed to see the bug in the implicit call generation
case.

Comment 8 David Baron 2006-03-21 08:28:07 UTC
Created attachment 126380 [details]
testcase with implicit call generation and no #includes

Comment 9 Benjamin Kosnik 2006-04-05 11:04:34 UTC
Can we just make this a tracker bug for all the gcc bugs WRT visibility? 

Comment 10 Jakub Jelinek 2006-04-05 11:05:54 UTC
I think so.

Comment 11 David Baron 2006-04-05 15:15:39 UTC
There were a bunch of commits for
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20297 recently.  Those may have
fixed the text relocations in Mozilla described in comment 0, although I haven't
tested.

Comment 12 Jakub Jelinek 2006-04-05 15:19:35 UTC
Sure, and not just PR20297.  But some of the changes now expose latent bugs
much more frequently.  See
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=187399
http://gcc.gnu.org/PR27000
http://gcc.gnu.org/PR26612
So, I'm going to revert PR c++/21764, c++/19238, c++/21581 fixes from rawhide
for the time being, until PR27000 and PR26612 get resolved.

Comment 13 David Baron 2006-05-27 19:52:17 UTC
It looks like the fix for this shipped in the FC5 update to gcc 4.1.1.

Comment 14 Jakub Jelinek 2006-08-29 09:31:50 UTC
I think we can close this now, to my knowledge all known visibility issues but
#198967 have been already resolved on redhat/gcc-4_1-branch.