Bug 29359 - bad relocation section name `' in .o causes segv of ld.
Summary: bad relocation section name `' in .o causes segv of ld.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-05 18:17 UTC by Jeffrey M. Birnbaum
Modified: 2006-10-05 20:49 UTC (History)
2 users (show)

See Also:
Host: Redhat FC5: 2.6.17-1.2187_FC5
Target: x86_64 GNU/Linux
Build: gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gzip'd tar file with README that shows how to reproduce (706.60 KB, application/octet-stream)
2006-10-05 18:18 UTC, Jeffrey M. Birnbaum
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey M. Birnbaum 2006-10-05 18:17:06 UTC
I have been encountering the following problem for several weeks. I compile and
create few c++ shared libraries (can happen with just one, so it has nothing to
do with the number). I then attempt to link a program and I get the following
type of  segv during the link step:

collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: build/x86-64.linux/gcc64/cc-g/subscribeClient.o: bad relocation
section name `'

It happens with both -O2 and -g compiled code (although it is a bit more
frequent with -g code). In addition, usually if it happens with -O2 code then it
will work fine when I compiled with -g (or vice-versa). 

I will attach a test case with a README file that shows how to reproduce.
Comment 1 Jeffrey M. Birnbaum 2006-10-05 18:18:00 UTC
Created attachment 12385 [details]
gzip'd tar file with README that shows how to reproduce
Comment 2 Andrew Pinski 2006-10-05 18:18:41 UTC
*** This bug has been marked as a duplicate of 29244 ***

*** This bug has been marked as a duplicate of 29244 ***
Comment 3 Andrew Pinski 2006-10-05 18:19:30 UTC
Didn't I already tell you to post this to binutils?
Comment 4 Jeffrey M. Birnbaum 2006-10-05 18:23:11 UTC
(In reply to comment #3)
> Didn't I already tell you to post this to binutils?
> 
yes you did and I did what you asked. However, I now believe that the problem is with the compiler. I also came up with a test case that demonstrates the problem. This is new info and why it should not be considered a duplicate. At the orig post I did not have a test case to demonstrate the problem. This problem is causing me great pain. Every time I change code, I get this problem and thus I can't get anything accomplished.
Comment 5 Jeffrey M. Birnbaum 2006-10-05 18:27:48 UTC
Subject: Re:  bad relocation section name `' in .o causes segv of ld.

Look, I am not trying to be a jerk, but this new filing has a test
case associated with it (another thing that you asked for). In
addition, I took your advice and filed the bug with binutils. However,
I now believe that the problem is with gcc and not ld. You based your
judgement on the segv coming from ld. If you look at the test and come
to the same conclusion then I will not bother you again.

This problem is causing me great pain. Every time I change code, I get
this problem
and thus I can't get anything accomplished.

/JMB

On 5 Oct 2006 18:19:30 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #3 from pinskia at gcc dot gnu dot org  2006-10-05 18:19 -------
> Didn't I already tell you to post this to binutils?
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29359
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> You reported the bug, or are watching the reporter.
>


Comment 6 Jeffrey M. Birnbaum 2006-10-05 18:41:41 UTC
This bug might be a duplicate as you suggest but (my fault for opening new instead of updating original) it is not 'resolved'. On the original post you said to report to binutils because you suggested the bug was not in the compiler. However, I now believe that the bug is in the compiler. I attached a test case with a README on how to reproduce. If you look at this, I think you will see that it is the compiler that produces bad output that ld chokes on. If you disagree with that assertion then please tell me.
 
Comment 7 Andrew Pinski 2006-10-05 18:48:04 UTC
> If you disagree with that assertion then please tell me.
Yes I do disagree because GCC only produces a .s file which then binutils assembles and links.
Then again you are using a GCC and binutils that were modified by Redhat which mean you should report it to them first.  If you try a FSF GCC and binutils and it fails, then you should report it to us but only after you have tried.
Comment 8 Jeffrey M. Birnbaum 2006-10-05 18:48:30 UTC
Subject: Re:  bad relocation section name `' in .o causes segv of ld.

One last comment. From the below, I think it is clear that the
compiler is the problem. If I compile with -g then I get the problem,
however if I compile without -g then I don't get the problem. Perhaps
I am wrong, but it appears that -g is producing .o that gives ld a
problem.

[jmb@localhost bugs]$ /usr/bin/g++ -ftemplate-depth-64
-Wno-ctor-dtor-privacy -Wreturn-type -D_GNU_SOURCE -fPIC -m64
-D_REENTRANT -D_GNU_SOURCE -D__USE_GNU -I. -I.. -o SPTest.o -c
SPTest.i
[jmb@localhost bugs]$ g++ -g -L. -o SPTest.1 SPTest.o -lutil_gcc64
-lstdc++ -lrt -lpthread

[jmb@localhost bugs]$ /usr/bin/g++ -g -ftemplate-depth-64
-Wno-ctor-dtor-privacy -Wreturn-type -D_GNU_SOURCE -fPIC -m64
-D_REENTRANT -D_GNU_SOURCE -D__USE_GNU -I. -I.. -o SPTest.o -c
SPTest.i
[jmb@localhost bugs]$ g++ -g -L. -o SPTest.1 SPTest.o -lutil_gcc64
-lstdc++ -lrt -lpthread
collect2: ld terminated with signal 11 [Segmentation fault]
/usr/bin/ld: SPTest.o: bad relocation section name `'
/usr/bin/ld: SPTest.o: bad relocation section name `'
/usr/bin/ld: SPTest.o: bad relocation section name `'


On 10/5/06, Jeffrey M. Birnbaum <jmbnyc@gmail.com> wrote:
> Look, I am not trying to be a jerk, but this new filing has a test
> case associated with it (another thing that you asked for). In
> addition, I took your advice and filed the bug with binutils. However,
> I now believe that the problem is with gcc and not ld. You based your
> judgement on the segv coming from ld. If you look at the test and come
> to the same conclusion then I will not bother you again.
>
> This problem is causing me great pain. Every time I change code, I get
> this problem
> and thus I can't get anything accomplished.
>
> /JMB
>
> On 5 Oct 2006 18:19:30 -0000, pinskia at gcc dot gnu dot org
> <gcc-bugzilla@gcc.gnu.org> wrote:
> >
> >
> > ------- Comment #3 from pinskia at gcc dot gnu dot org  2006-10-05 18:19 -------
> > Didn't I already tell you to post this to binutils?
> >
> >
> > --
> >
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29359
> >
> > ------- You are receiving this mail because: -------
> > You are on the CC list for the bug, or are watching someone who is.
> > You reported the bug, or are watching the reporter.
> >
>
>
> --
> /JMB
>


Comment 9 Jeffrey M. Birnbaum 2006-10-05 18:51:05 UTC
Subject: Re:  bad relocation section name `' in .o causes segv of ld.

Fair enough. I did report it to them, but never heard back. Uli
Drepper is going to try to help me get to the right people. He has
also offered to look at the .s file to see if he see anything
suspicious.
/JMB

On 5 Oct 2006 18:48:06 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #7 from pinskia at gcc dot gnu dot org  2006-10-05 18:48 -------
> > If you disagree with that assertion then please tell me.
> Yes I do disagree because GCC only produces a .s file which then binutils
> assembles and links.
> Then again you are using a GCC and binutils that were modified by Redhat which
> mean you should report it to them first.  If you try a FSF GCC and binutils and
> it fails, then you should report it to us but only after you have tried.
>
>
> --
>
> pinskia at gcc dot gnu dot org changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |RESOLVED
>           Component|c++                         |middle-end
>          Resolution|                            |INVALID
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29359
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> You reported the bug, or are watching the reporter.
>


Comment 10 Daniel Jacobowitz 2006-10-05 20:49:45 UTC
FYI, the testcase does not build with my system g++ 4.1.2; remove the "static" from 'extern "C" static'.  The result does not choke my system's binutils, i.e. it links successfully.

If I use the provided .s file instead of compiling the .i file, it again links successfully.  Therefore, I conclude that this is a bug in the linker (or possibly assembler) on your platform, and there is no bug in GCC.  This is the same conclusion Andrew came to, except that I actually looked at the bug.

Andrew, again I need to ask you to be more polite to bug submitters.  You shouldn't need to be reminded of this so often!
Comment 11 Jeffrey M. Birnbaum 2006-10-05 20:57:34 UTC
Subject: Re:  bad relocation section name `' in .o causes segv of ld.

Thanks for looking at it. Uli Drepper helped me to look at the asm and
conclude (just about one hour ago) that indeed the problem is with
"as". It clearly screws up with symbols names. Uli tried with binutils
from FC6 and does not get the problem.

Also, thanks for pointing out the extern "C" thing. I moved some code
around and left that in which was not good.

I am going to try to upgrade to the binutils with FC6 and hope that it
solves the problem. I would file a report with the "as" guys.

BTW, I know that you guys are busy, so thanks for taking a look. This
problem has been killing my development.
/JMB

On 5 Oct 2006 20:49:45 -0000, drow at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #10 from drow at gcc dot gnu dot org  2006-10-05 20:49 -------
> FYI, the testcase does not build with my system g++ 4.1.2; remove the "static"
> from 'extern "C" static'.  The result does not choke my system's binutils, i.e.
> it links successfully.
>
> If I use the provided .s file instead of compiling the .i file, it again links
> successfully.  Therefore, I conclude that this is a bug in the linker (or
> possibly assembler) on your platform, and there is no bug in GCC.  This is the
> same conclusion Andrew came to, except that I actually looked at the bug.
>
> Andrew, again I need to ask you to be more polite to bug submitters.  You
> shouldn't need to be reminded of this so often!
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29359
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> You reported the bug, or are watching the reporter.
>