This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in gas generating sh PIC, or is it me?


Daniel Jacobowitz wrote:
On Fri, Nov 29, 2002 at 03:43:14PM -0800, Dan Kegel wrote:
For what it's worth, a coworker found that on sh4,
binutils as shipped by Hard Hat 2.0, and also
vanilla binutils 2.13, caused problems with shared libraries.
binutils 2.13.1 works fine. ...
That's a different problem - and I think that I'll pull this new fix in
for 2.13.2, since I slipped on getting it out before I left for
Thanksgiving.  HH2.0's ought to have worked but I certainly don't care
enough to find out why it didn't if 2.13.1 works :)
For what it's worth, here's the test case.
It's unfair of me to call this an HH2.0 problem, since
we are using newer compilers (gcc3.0.2) and C libraries, but
the problem did go away when we replaced HH2.0's binutils
with 2.13.1.  (Or so says my coworker.  I'm about to verify this myself.)

::::::::::::::
libsotest.cc
::::::::::::::
#include <string>

extern std::string getSharedString(void)
{
    return std::string("TheSharedString");
}
::::::::::::::
sotest.cc
::::::::::::::
#include <iostream>

extern std::string getSharedString(void);

int main(int argc, char * argv[])
{
    std::cout << "Got '" <<  getSharedString() << "'" << std::endl;
    std::cout << "PASS" << std::endl;

    return 0;
}
::::::::::::::
test.sh
::::::::::::::
#!/bin/sh

/opt/hardhat/devkit/sh/sh4_le/bin/sh4-linux-g++ -ml -m4 -shared -fPIC libsotest.cc -o libsotest.so
/opt/hardhat/devkit/sh/sh4_le/bin/sh4-linux-g++ -ml -m4 sotest.cc -L. -lsotest -o sotest

echo Now transfer libsotest.so and sotest to an sh4 board and run them with
echo LD_LIBRARY_PATH=. ./sotest
echo
echo Expected output if it works is
echo "  Got 'TheSharedString'"
echo "  PASS"
echo but a segfault if it fails.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]