Project

General

Profile

Bug #11561

loader script needs to place .eh_frame after .text

Added by John Levon 11 months ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

History

#1

Updated by John Levon 11 months ago

Our GCC7 build failed with:


/root/data/jenkins/workspace/platform-debug-gcc7/projects/illumos/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/btxld -V 1.1-2019.08.15.1 -o loader64.efi loader.bin
Unable to find multiboot header

The issue is that the .eh_frame in the source ELF binary grew so large that even though we're careful to
place multiboot.o at the start of .text, it's still past the 64Kb limit that btxld searches for the fake mb_header:

Section Header[2]:  sh_name: .eh_frame
    sh_addr:      0x2000              sh_flags:   [ SHF_ALLOC ]
    sh_size:      0xfa60              sh_type:    [ SHT_PROGBITS ]
    sh_offset:    0x3000              sh_entsize: 0
    sh_link:      0                   sh_info:    0
    sh_addralign: 0x8               

Section Header[3]:  sh_name: .text
    sh_addr:      0x12000             sh_flags:   [ SHF_ALLOC SHF_EXECINSTR ]
    sh_size:      0x47ad3             sh_type:    [ SHT_PROGBITS ]
    sh_offset:    0x13000             sh_entsize: 0
    sh_link:      0                   sh_info:    0
    sh_addralign: 0x10              

$ dec 0x13000
77824

It looks like we can modify the ld script to move .eh_frame to after .text instead.

#2

Updated by Electric Monk 11 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit dcfeff93f67a1188722a358e0fbfcd604993e573

commit  dcfeff93f67a1188722a358e0fbfcd604993e573
Author: John Levon <john.levon@joyent.com>
Date:   2019-08-15T20:31:06.000Z

    11561 loader script needs to place .eh_frame after .text
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF