Bug 24701

Summary: Irix 6.5.30, gcc8.2.0, LD does not output well formed executables
Product: binutils Reporter: Daniel Hams <daniel.hams>
Component: ldAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: P2    
Version: 2.32   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: roll back changes to local/global symbol relocation for irix linker
patch against 2.26.1 that gets irix binaries working once more

Description Daniel Hams 2019-06-18 21:27:30 UTC
I realise this is a bug for a long since discontinued operating system - apologies for that.

The SGI enthusiast community is in the process of trying to get more modern tools up and running for these machines - and right now we have a mostly OK gcc8.2.0 for C when using binutils-2.19.

When using binutils-2.32 - LD doesn't produce valid executables - launching them in DBX shows the following:

Executable /usr/people/dan/Sources/ldtests/./exe.gcc8.gitld
(dbx) run
Now execute givenfile with the following call:
execvp("/usr/didbs/bin/bash", 
	"/usr/didbs/bin/bash",
	"-c",
	"exec ././exe.gcc8.gitld",
	(char *)0);
Warning: SymbolTableDwarf: RA register is DW_FRAME_UNDEFINED_VAL in frame 1034, pc 0xfae43c0
Process  1699 (exe.gcc8.gitld) started
Process  1699 (exe.gcc8.gitld) stopped on signal SIGSEGV: Segmentation violation (default) at [build_entire_object_list:446 ,0xfb6ff6c]
	 Source (of /j7/mtibuild/v744/workarea/v7.4.4m/rld/rld_startup.c) not available for Process  1699
(dbx) where
>  0 build_entire_object_list(0xfbd7c58, 0x2, 0x7ffd7da0, 0x34, 0x0, 0x0, 0x76, 0x2) ["/j7/mtibuild/v744/workarea/v7.4.4m/rld/rld_startup.c":446, 0xfb6ff6c]
   1 read_aux_vec_and_build_objlist(0x2, 0x10000000, 0x40, 0x34, 0x0, 0x0, 0x76, 0x2) ["/j7/mtibuild/v744/workarea/v7.4.4m/rld/rld_startup.c":1508, 0xfb71104]
   2 sgi_main(0x0, 0x7ffd7f54, 0x7ffd7f54, 0x34, 0x0, 0x0, 0x76, 0x2) ["/j7/mtibuild/v744/workarea/v7.4.4m/rld/rld_startup.c":1648, 0xfb71344]
   3 newmain() ["/j7/mtibuild/v744/workarea/v7.4.4m/rld/rld_newmain.s":68, 0xfb60184]
(dbx) 

Notably - GAS seems fine and using an earlier LD with 2.32 GAS will produce valid executables.

You can find some built binaries and some readelf dumps of them here:

https://github.com/danielhams/irix-binutils-investigation

The failing executable there is this one:

https://github.com/danielhams/irix-binutils-investigation/blob/master/exe.gcc8.ld232

Kr,

Dan
Comment 1 Daniel Hams 2019-06-18 21:40:52 UTC
If it helps at all,

I did bisect which commit broke the linking - and as far as I can tell -

There was a commit 19 Sep 2010 that did some re-work of the BFD mips handling:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=020d7251584c7ac86ab48a9eaa9bdefc53935d09

The previous commit where I still see success in building gcc using gas/gld - is here:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=f7ff11061f3278dce60be909b9f63d94cbd38afd
Comment 2 Daniel Hams 2019-07-06 07:09:13 UTC
Created attachment 11889 [details]
roll back changes to local/global symbol relocation for irix linker
Comment 3 Daniel Hams 2019-07-06 07:10:32 UTC
The above is patch against binutils 2.21.

I don't want (or expect) these changes to be merged - but someone might find this useful.
Comment 4 Daniel Hams 2019-07-07 11:52:57 UTC
Created attachment 11894 [details]
patch against 2.26.1 that gets irix binaries working once more