changeset 6282:04693165013a

Fix mingw lilypond-installer crash nsis entry point and section table
author Masamichi Hosoda <trueroad@users.noreply.github.com>
date Sun, 16 Nov 2014 22:30:29 +0900
parents c5980a071dd7
children 572749c1b0c5
files gub/specs/nsis.py patches/nsis-2.46-crossmingw.patch patches/nsis-2.46-linker_script-default.patch patches/nsis-2.46-linker_script-ndata.patch
diffstat 4 files changed, 324 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gub/specs/nsis.py	Sun Nov 16 02:10:29 2014 +0900
+++ b/gub/specs/nsis.py	Sun Nov 16 22:30:29 2014 +0900
@@ -11,6 +11,8 @@
     patches = [
         'nsis-2.46-crossmingw.patch',
         'nsis-2.46-util.patch',
+        'nsis-2.46-linker_script-default.patch',
+        'nsis-2.46-linker_script-ndata.patch',
     ]
     scons_flags = misc.join_lines ('''
 DEBUG=yes
--- a/patches/nsis-2.46-crossmingw.patch	Sun Nov 16 02:10:29 2014 +0900
+++ b/patches/nsis-2.46-crossmingw.patch	Sun Nov 16 22:30:29 2014 +0900
@@ -10,13 +10,31 @@
      env['AR'] = mingw_prefix + 'ar'
      env['RANLIB'] = mingw_prefix + 'ranlib'
 --- a/SCons/Config/gnu	2009-02-05 09:52:28.000000000 +0900
-+++ b/SCons/Config/gnu	2014-11-16 00:18:14.838514000 +0900
-@@ -24,7 +24,7 @@
++++ b/SCons/Config/gnu	2014-11-16 21:13:24.803686400 +0900
+@@ -19,12 +19,12 @@
+ 		x = '_WinMain@16'
+ 	elif x == 'DllMain':
+ 		x = '_DllMain@12'
+-	return '-Wl,-e%s' % x
++	return ''
+ 
  defenv['ENTRY_FLAG'] = entry
  defenv['MAP_FLAG'] = '-Wl,-Map,${TARGET.base}.map'
  defenv['EXCEPTION_FLAG'] = ''
 -defenv['NODEFLIBS_FLAG'] = '-nostdlib -Wl,--exclude-libs,msvcrt.a'
-+defenv['NODEFLIBS_FLAG'] = '-Wl,--exclude-libs,msvcrt.a'
++defenv['NODEFLIBS_FLAG'] = ''
  defenv['C_FLAG'] = '-xc'
  defenv['CPP_FLAG'] = '-xc++'
  defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
+@@ -77,9 +77,9 @@
+ if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
+ 	stub_env.Append(LINKFLAGS = ['-s'])               # strip
+ stub_env.Append(LINKFLAGS = ['-mwindows'])          # build windows executables
+-stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG'])    # no standard libraries
++#stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG'])    # no standard libraries
+ stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])        # 512 bytes align
+-stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
++#stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
+ stub_env.Append(LINKFLAGS = ['$MAP_FLAG'])          # generate map file
+ 
+ ### makensis environment
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-linker_script-default.patch	Sun Nov 16 22:30:29 2014 +0900
@@ -0,0 +1,286 @@
+The deafult linker script is acquirable by the following command.
+
+i686-mingw32-ld --verbose
+
+--- a/SCons/Config/linker_script	2005-08-06 00:27:58.000000000 +0900
++++ b/SCons/Config/linker_script	2014-11-16 15:15:01.302783500 +0900
+@@ -1,57 +1,63 @@
++/* Default linker script, for normal executables */
+ OUTPUT_FORMAT(pei-i386)
++SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
+ SECTIONS
+ {
+-  .text  __image_base__ + __section_alignment__  :
++  /* Make the virtual address and file offset synced if the alignment is
++     lower than the target page size. */
++  . = SIZEOF_HEADERS;
++  . = ALIGN(__section_alignment__);
++  .text  __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
+   {
+      *(.init)
+     *(.text)
+     *(SORT(.text$*))
++     *(.text.*)
++     *(.gnu.linkonce.t.*)
+     *(.glue_7t)
+     *(.glue_7)
+-   	___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+-			LONG (-1);
+-			*(EXCLUDE_FILE (*crtend.o) .ctors);
+-			*(.ctor);
+-			*(SORT(.ctors.*));
+-			*crtend.o (.ctors);
+-			LONG (0);
+-    	___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+-			LONG (-1);
+-			*(EXCLUDE_FILE (*crtend.o) .dtors);
+-			*(.dtor);
+-			*(SORT(.dtors.*));
+-			*crtend.o (.dtors);
+-			LONG (0);
++     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
++			LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0);
++     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
++			LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0);
+      *(.fini)
+     /* ??? Why is .gcc_exc here?  */
+      *(.gcc_exc)
+     PROVIDE (etext = .);
+-    *(.gcc_except_table)
++    PROVIDE (_etext = .);
++     *(.gcc_except_table)
+   }
+   /* The Cygwin32 library uses a section to avoid copying certain data
+      on fork.  This used to be named ".data".  The linker used
+      to include this between __data_start__ and __data_end__, but that
+      breaks building the cygwin32 dll.  Instead, we name the section
+-     ".data_cygwin_nocopy" and explictly include it after __data_end__. */
++     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
+   .data BLOCK(__section_alignment__) :
+   {
+     __data_start__ = . ;
+     *(.data)
+     *(.data2)
+     *(SORT(.data$*))
++    *(.jcr)
+     __data_end__ = . ;
+     *(.data_cygwin_nocopy)
+   }
+   .rdata BLOCK(__section_alignment__) :
+   {
+     *(.rdata)
+-    *(SORT(.rdata$*))
+-    *(.eh_frame)
+-    ___RUNTIME_PSEUDO_RELOC_LIST__ = .;
+-    __RUNTIME_PSEUDO_RELOC_LIST__ = .;
++             *(SORT(.rdata$*))
++    __rt_psrelocs_start = .;
+     *(.rdata_runtime_pseudo_reloc)
+-    ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
+-    __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
++    __rt_psrelocs_end = .;
++  }
++  __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
++  ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
++  __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
++  ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
++  __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
++  .eh_frame BLOCK(__section_alignment__) :
++  {
++    *(.eh_frame*)
+   }
+   .pdata BLOCK(__section_alignment__) :
+   {
+@@ -74,6 +80,8 @@
+     *(.debug$T)
+     *(.debug$F)
+     *(.drectve)
++     *(.note.GNU-stack)
++     *(.gnu.lto_*)
+   }
+   .idata BLOCK(__section_alignment__) :
+   {
+@@ -84,7 +92,9 @@
+     /* These zeroes mark the end of the import list.  */
+     LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
+     SORT(*)(.idata$4)
++    __IAT_start__ = .;
+     SORT(*)(.idata$5)
++    __IAT_end__ = .;
+     SORT(*)(.idata$6)
+     SORT(*)(.idata$7)
+   }
+@@ -106,12 +116,18 @@
+     *(SORT(.CRT$XT*))  /* Termination */
+     ___crt_xt_end__ = . ;
+   }
++  /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
++     at the end of section.  This is important because _tls_start MUST
++     be at the beginning of the section to enable SECREL32 relocations with TLS
++     data.  */
+   .tls BLOCK(__section_alignment__) :
+   {
+     ___tls_start__ = . ;
++    *(.tls$AAA)
+     *(.tls)
+     *(.tls$)
+     *(SORT(.tls$*))
++    *(.tls$ZZZ)
+     ___tls_end__ = . ;
+   }
+   .endjunk BLOCK(__section_alignment__) :
+@@ -121,10 +137,6 @@
+     PROVIDE ( _end = .);
+      __end__ = .;
+   }
+-  .ndata BLOCK(__section_alignment__) :
+-  {
+-    *(.ndata)
+-  }
+   .rsrc BLOCK(__section_alignment__) :
+   {
+     *(.rsrc)
+@@ -151,60 +163,141 @@
+   {
+     *(.debug_aranges)
+   }
++  .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_aranges)
++  }
+   .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_pubnames)
+   }
++  .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_pubnames)
++  }
++  .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.debug_pubtypes)
++  }
++  .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_pubtypes)
++  }
+   /* DWARF 2.  */
+   .debug_info BLOCK(__section_alignment__) (NOLOAD) :
+   {
+-    *(.debug_info) *(.gnu.linkonce.wi.*)
++    *(.debug_info .gnu.linkonce.wi.*)
++  }
++  .zdebug_info BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_info .zdebug.gnu.linkonce.wi.*)
+   }
+   .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_abbrev)
+   }
++  .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_abbrev)
++  }
+   .debug_line BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_line)
+   }
++  .zdebug_line BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_line)
++  }
+   .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
+   {
+-    *(.debug_frame)
++    *(.debug_frame*)
++  }
++  .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_frame*)
+   }
+   .debug_str BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_str)
+   }
++  .zdebug_str BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_str)
++  }
+   .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_loc)
+   }
++  .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_loc)
++  }
+   .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_macinfo)
+   }
++  .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_macinfo)
++  }
+   /* SGI/MIPS DWARF 2 extensions.  */
+   .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_weaknames)
+   }
++  .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_weaknames)
++  }
+   .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_funcnames)
+   }
++  .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_funcnames)
++  }
+   .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_typenames)
+   }
++  .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_typenames)
++  }
+   .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_varnames)
+   }
++  .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_varnames)
++  }
++  .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.debug_macro)
++  }
++  .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_macro)
++  }
+   /* DWARF 3.  */
+   .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
+   {
+     *(.debug_ranges)
+   }
++  .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_ranges)
++  }
++  /* DWARF 4.  */
++  .debug_types BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.debug_types .gnu.linkonce.wt.*)
++  }
++  .zdebug_types BLOCK(__section_alignment__) (NOLOAD) :
++  {
++    *(.zdebug_types .gnu.linkonce.wt.*)
++  }
+ }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/nsis-2.46-linker_script-ndata.patch	Sun Nov 16 22:30:29 2014 +0900
@@ -0,0 +1,15 @@
+.ndata section is added to the default linker script.
+
+--- a/SCons/Config/linker_script	2014-11-16 15:15:01.302783500 +0900
++++ b/SCons/Config/linker_script	2014-11-16 20:57:45.209797100 +0900
+@@ -137,6 +137,10 @@
+     PROVIDE ( _end = .);
+      __end__ = .;
+   }
++  .ndata BLOCK(__section_alignment__) :
++  {
++    *(.ndata)
++  }
+   .rsrc BLOCK(__section_alignment__) :
+   {
+     *(.rsrc)