Bug 728201

Summary: stubs don't match calculated size, /usr/bin/ld: can not build stubs: Invalid operation
Product: [Fedora] Fedora Reporter: Karsten Hopp <karsten>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 16CC: amodra, bergner, jakub, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Unspecified   
Whiteboard:
Fixed In Version: binutils-2.21.53.0.1-6.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-21 17:01:00 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:

Description Karsten Hopp 2011-08-04 11:18:42 UTC
Description of problem:
several packages fail to build on ppc with this error:
stubs don't match calculated size
/usr/bin/ld: can not build stubs: Invalid operation
collect2: ld returned 1 exit status

p.e.
http://ppc.koji.fedoraproject.org/koji/getfile?taskID=267258&name=build.log
http://ppc.koji.fedoraproject.org/koji/getfile?taskID=267473&name=build.log
http://ppc.koji.fedoraproject.org/koji/getfile?taskID=267137&name=build.log


Version-Release number of selected component (if applicable):
binutils-2.21.53.0.1-1.fc16

How reproducible:
always

Steps to Reproduce:
1. ppc-koji build --scratch f16 llvm-2.9-2.fc16.src.rpm

This is blocking builds of many other packages ;-(

Comment 1 Jakub Jelinek 2011-08-04 16:56:06 UTC
Perhaps http://sources.redhat.com/ml/binutils/2011-08/msg00011.html ? 
And/or it might be related to the local ppc64 change in our gcc (for many years now):
+#ifdef HAVE_LD_OVERLAPPING_OPD
+/* If the linker supports overlapping .opd entries and we know this function
+   doesn't ever use r11 passed to it, we can overlap the fd_aux function
+   descriptor field with next function descriptor's fd_func field.  */
+# define OVERLAPPING_OPD (cfun->static_chain_decl == NULL)
+#else
+# define OVERLAPPING_OPD 0
+#endif
...
@@ -25938,7 +25925,8 @@ rs6000_elf_declare_function_name (FILE *
       ASM_OUTPUT_LABEL (file, name);
       fputs (DOUBLE_INT_ASM_OP, file);
       rs6000_output_function_entry (file, name);
-      fputs (",.TOC.@tocbase,0\n\t.previous\n", file);
+      fprintf (file, ",.TOC.@tocbase%s\n\t.previous\n",
+              OVERLAPPING_OPD ? "" : ",0");
       if (DOT_SYMBOLS)
        {
          fputs ("\t.size\t", file);
where we emit just 16 byte .opd entries instead of 24 bytes if we can ignore the r11 value in the function.

Comment 2 Peter Bergner 2011-08-05 15:18:34 UTC
Alan, do you have any ideas what might be wrong here?

Comment 3 Alan Modra 2011-08-05 16:44:03 UTC
Peter, Jakub quizzed me earlier today on this bug.  I replied that the opd squashing won't affect stub sizing as far as I can see.  I'm guessing that binutils-2.21.53.0.1-1.fc16 has my 2011-07-14 change included, which had a bug in stub sizing, fixed here:

2011-08-02  Alan Modra  <amodra>

	* elf64-ppc.c (build_plt_stub): Correct emitted relocs when no
	plt_static_chain.
	(ppc_build_one_stub): Adjust get_relocs call to suit..
	(ppc_size_one_stub): ..and reloc sizing.  Correct plt size corner case.
	                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Comment 4 Peter Bergner 2011-08-05 17:15:37 UTC
Ah, I guess I misunderstood what Jakub was saying.  I thought Jakub was pointing at your patch as the culprit and not as a potential fix.  Ok, so it seems fedora just needs to grab your latest fix and we should be good.  Thanks.

Comment 5 Fedora Update System 2011-12-14 12:09:11 UTC
binutils-2.21.53.0.1-6.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/binutils-2.21.53.0.1-6.fc16

Comment 6 Fedora Update System 2011-12-14 23:33:26 UTC
Package binutils-2.21.53.0.1-6.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing binutils-2.21.53.0.1-6.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-17104/binutils-2.21.53.0.1-6.fc16
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2011-12-21 17:01:00 UTC
binutils-2.21.53.0.1-6.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.