Bug 493712 - Relocation R_X86_64_PC32 error when compiling C++ code with -fvisibility-inlines-hidden
Summary: Relocation R_X86_64_PC32 error when compiling C++ code with -fvisibility-inli...
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc43
Version: 5.3
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-02 19:17 UTC by Robert Hancock
Modified: 2013-03-21 19:14 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-21 19:14:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Robert Hancock 2009-04-02 19:17:47 UTC
Description of problem:
We have a class defined like this defined in a header file:

template <class state_t, class event_t>
class UFSM_Base_FSM
{

...

    virtual ~UFSM_Base_FSM()
    {
	monitor.release();
    }
}

and a class that inherits from it:

class MFSM_FSM
    : public UFSM_Base_FSM<int,mobj_msg_id_t>
{

...

    virtual ~MFSM_FSM();		/* Destructor */
}

with the empty destructor being defined non-inline.

When the MFSM_FSM class is compiled using -fvisibility-inlines-hidden and the code is built into a shared library, this error results:

/usr/bin/ld: mfsm_fsm.o: relocation R_X86_64_PC32 against `UFSM_Base_FSM<int, mobj_msg_id_t>::~UFSM_Base_FSM()' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

The -fPIC flag is being used when compiling all code.

Version-Release number of selected component (if applicable):
gcc43-4.3.2-7.el5

How reproducible:
Every time

Steps to Reproduce:
1. Compile code like the above and link into shared library (not sure how reproducible the problem is without the entire code base)
2.
3.
  
Actual results:
link succeeds

Expected results:
link fails

Additional info:

Comment 1 Jeff Law 2013-03-21 19:14:20 UTC
This kind of error can result from incorrect command line options, undefined virtual methods, a linker bug with protected symbols, etc.

Without a full testcase we can not fully analyze this problem to determine if it is a problem in your code, the compiler, assembler or linker.  A full testcase would consist of source code and the exact commands you use to show the problem.

It is also the case that gcc43 is no longer supported on the Red Hat Enterprise Linux platform.  It was replaced by "gcc44" a while back.

I'm closing this as INSUFFICIENT_DATA; you may reopen it by providing the requested information so that we can fully analyze the issue.


Note You need to log in before you can comment on or make changes to this bug.