Bug 1547747

Summary: gold produces broken executables
Product: [Fedora] Fedora Reporter: Serge Pavlovsky <pal666>
Component: binutilsAssignee: Nick Clifton <nickc>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 27CC: aoliva, dvlasenk, hongjiu.lu, jakub, nickc, pal666
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 07:19:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
"bad" object, caller(main) object and demonstrating shell script none

Description Serge Pavlovsky 2018-02-21 20:42:20 UTC
Created attachment 1399000 [details]
"bad" object, caller(main) object and demonstrating shell script

Description of problem:
same code linked by ld.bfd works fine,linked by ld.gold jumps into the middle of instruction

Version-Release number of selected component (if applicable):
binutils-2.29-6.fc27.x86_64

How reproducible:
$ LANG=C ./run.sh 
+ link bfd
+ gcc codectest.c.o pscopyca.o -o codectest.bfd -fuse-ld=bfd
+ ./codectest.bfd
+ link gold
+ gcc codectest.c.o pscopyca.o -o codectest.gold -fuse-ld=gold
+ ./codectest.gold
./run.sh: line 3: 17605 Segmentation fault      (core dumped) ./codectest.$1


Steps to Reproduce:
1. link attached objects with ld.gold
2. run executable

Actual results:
sigsegv

Expected results:
clean exit

Additional info:
link with ld.bfd to see correct behavior

Comment 1 Nick Clifton 2018-02-23 12:24:16 UTC
I have submitted this bug report to the FSF binutils project so that the gold
maintainers can take a look at it:

https://sourceware.org/bugzilla/show_bug.cgi?id=22883

Comment 2 Nick Clifton 2018-03-23 12:28:11 UTC
Hi Serge,

  The conclusion from the binutils maintainers appears to be that the
  pscopyca.o file is corrupt.  (Specifically it is using a RELA relocation
  but storing it like a REL relocation).

  Please can you tell us how it was created ?

Cheers
  Nick

Comment 3 Serge Pavlovsky 2018-03-29 00:31:17 UTC
it is part of old binary only intel media codecs library

Comment 4 Nick Clifton 2018-03-29 07:19:53 UTC
Hi Serge,

  In which case all I can say is that that binary is broken.  The
  relocations in it are incorrect and cannot and will not be
  processed correctly by todays linkers.  Sorry.

Cheers
  Nick