View Issue Details

IDProjectCategoryView StatusLast Update
0036174FPCCompilerpublic2019-10-20 01:24
ReporterDo-wan KimAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.3.1Product Build43194 
Target VersionFixed in Version3.3.1 
Summary0036174: x86 compile broken after r43157.
DescriptionAfter r43157, compiled executable raise error "side by side configuration is incorrect" and cannot run anymore.
Revert to r43156, it works fine.
TagsNo tags attached.
Fixed in Revision43267
FPCOldBugId
FPCTarget-
Attached Files
  • 36174-assemble.pas.patch (872 bytes)
    Index: compiler/assemble.pas
    ===================================================================
    --- compiler/assemble.pas	(revision 43199)
    +++ compiler/assemble.pas	(working copy)
    @@ -1673,9 +1673,11 @@
                    end;
                  ait_section:
                    begin
    +{$if not ((defined(CPUX86) or defined(CPUX86_64)) and defined(WINDOWS))}
                      if Tai_section(hp).sectype=sec_user then
                        ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).secflags,Tai_section(hp).secprogbits,Tai_section(hp).name^,Tai_section(hp).secorder)
                      else
    +{$endif not (defined(CPUX86) or defined(CPUX86_64)) and defined(WINDOWS)}
                        ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);
                      Tai_section(hp).sec:=ObjData.CurrObjSec;
                    end;
    
  • 36174-assemble.pas-v2.patch (998 bytes)
    Index: compiler/assemble.pas
    ===================================================================
    --- compiler/assemble.pas	(revision 43218)
    +++ compiler/assemble.pas	(working copy)
    @@ -1673,7 +1673,9 @@
                    end;
                  ait_section:
                    begin
    -                 if Tai_section(hp).sectype=sec_user then
    +                 if (not (target_info.system in [system_i386_GO32V2,system_i386_OS2,system_i386_Win32,system_i386_wdosx,system_i386_watcom,system_x86_64_win64,
    +                                                 system_i386_wince,system_i386_nativent,system_i8086_msdos,system_i8086_win16])) and 
    +                   (Tai_section(hp).sectype=sec_user) then
                        ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).secflags,Tai_section(hp).secprogbits,Tai_section(hp).name^,Tai_section(hp).secorder)
                      else
                        ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);
    

Activities

Jonas Maebe

2019-10-14 08:32

manager   ~0118580

On which operating system? And do you mean i386 or x86-64?

Do-wan Kim

2019-10-14 11:00

reporter   ~0118581

Last edited: 2019-10-14 11:04

View 2 revisions

Under Windows 10 x86-64, but I compiled by i386-win32. It may also affected win64.
I guess PE structure is broken and application icon also not shown correctly.

I'm using 3.0.4 bootstrap and '-dTEST_WIN32_SEH' switch.

Cyrax

2019-10-14 15:26

reporter   ~0118587

I can confirm this. I'm cross compiling an application from i386-linux to i386-win32 target and it refuses to start under Windows Server 2008 R2 SP1.

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

Cyrax

2019-10-14 15:39

reporter   ~0118588

Last edited: 2019-10-14 15:46

View 4 revisions

Strange, only Windows GUI programs seems to be affected. Console ones works.
EDIT: Eh, simple Windows GUI programs works, too. It seems that only DoubleCommander does have this bug.
EDIT2: Nope, it is enabling external debug symbol file which causes this bug to happen.

Do-wan Kim

2019-10-15 01:23

reporter   ~0118607

At build time, WER(Windows error report) constantly appear in process list. It make long build time.
In event log, 'ppc2.exe', 'ppc386.exe, 'fpc.exe', 'fpcres.exe' are listed as APPCRASH event type.

I change DEP setting on windows and no effect.

Akira1364

2019-10-15 04:50

reporter   ~0118609

Last edited: 2019-10-15 04:52

View 2 revisions

I'm using native 64-bit FPC on 64-bit Windows 10, and seemed to have been affected by this also as for the last few days I was noticing the Windows event log getting filled up with hundreds of access violation error notifications from FPC-related executables (including the compiler.)

I wasn't sure when it started though, but after seeing this issue and the suggestion that it began with r43157, I believe I've tracked down the breaking change. Specifically, prior to r43157, in "assemble.pas", lines 1673 to 1677 looked like this:

ait_section:
  begin
    ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);
    Tai_section(hp).sec:=ObjData.CurrObjSec;
  end;

After r43157, that case branch starts at line 1674 and goes to line 1681, and looks like this:

ait_section:
  begin
    if Tai_section(hp).sectype=sec_user then
      ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).secflags,Tai_section(hp).secprogbits,Tai_section(hp).name^,Tai_section(hp).secorder)
    else
      ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);
    Tai_section(hp).sec:=ObjData.CurrObjSec;
  end;

Adding a define so that only the code that existed before r43157 is compiled for x86 and x86_64 Windows, as in the following:

ait_section:
  begin
{$if not ((defined(CPUX86) or defined(CPUX86_64)) and defined(WINDOWS))}
    if Tai_section(hp).sectype=sec_user then
      ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).secflags,Tai_section(hp).secprogbits,Tai_section(hp).name^,Tai_section(hp).secorder)
    else
{$endif not (defined(CPUX86) or defined(CPUX86_64)) and defined(WINDOWS)}
      ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);
    Tai_section(hp).sec:=ObjData.CurrObjSec;
  end;

completely fixes the issue for me after doing a full rebuild of the compiler / utilities / RTL / etc.

Do-wan Kim

2019-10-15 07:03

reporter   ~0118611

@Akira1364 Wow, good catch. With your patch, build everything flawlessly. No more windows error report on windows event log.

36174-assemble.pas.patch (872 bytes)
Index: compiler/assemble.pas
===================================================================
--- compiler/assemble.pas	(revision 43199)
+++ compiler/assemble.pas	(working copy)
@@ -1673,9 +1673,11 @@
                end;
              ait_section:
                begin
+{$if not ((defined(CPUX86) or defined(CPUX86_64)) and defined(WINDOWS))}
                  if Tai_section(hp).sectype=sec_user then
                    ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).secflags,Tai_section(hp).secprogbits,Tai_section(hp).name^,Tai_section(hp).secorder)
                  else
+{$endif not (defined(CPUX86) or defined(CPUX86_64)) and defined(WINDOWS)}
                    ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);
                  Tai_section(hp).sec:=ObjData.CurrObjSec;
                end;

Akira1364

2019-10-15 07:08

reporter   ~0118612

Thanks for putting it in a real patch file, I guess I should have done that myself!

Cyrax

2019-10-16 00:25

reporter   ~0118627

Which command line options you are using to build whole FPC suite?

Do-wan Kim

2019-10-16 02:05

reporter   ~0118628

I compiled via fpclazup, only add '-dTEST_WIN32_SEH'
In make process, option shows '-vw-n-h-i-l-d-u-t-p-c-x- -dTEST_WIN32_SEH'.

Cyrax

2019-10-16 07:21

reporter   ~0118629

Thanks for that info, Do-wan Kim.

Sven Barth

2019-10-17 22:41

manager   ~0118652

@Akira1364: Your defines are not correct: They won't help if you cross-compile from another platform. You need to check target_info.system to work around the problem correctly.

Akira1364

2019-10-17 22:56

reporter   ~0118653

Last edited: 2019-10-17 22:57

View 2 revisions

Yeah, I wasn't so sure that'd necessarily be the "ultimately correct" way to do it.

If we know for certain that it's specifically only x86 and x86_64 Windows for which the newly added if-branch is wrong,
I'll happily submit a patch with the target_info-based changes.

Do-wan Kim

2019-10-18 01:57

reporter   ~0118655

Make taget_info based and include unknown systems that may affected.

36174-assemble.pas-v2.patch (998 bytes)
Index: compiler/assemble.pas
===================================================================
--- compiler/assemble.pas	(revision 43218)
+++ compiler/assemble.pas	(working copy)
@@ -1673,7 +1673,9 @@
                end;
              ait_section:
                begin
-                 if Tai_section(hp).sectype=sec_user then
+                 if (not (target_info.system in [system_i386_GO32V2,system_i386_OS2,system_i386_Win32,system_i386_wdosx,system_i386_watcom,system_x86_64_win64,
+                                                 system_i386_wince,system_i386_nativent,system_i8086_msdos,system_i8086_win16])) and 
+                   (Tai_section(hp).sectype=sec_user) then
                    ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).secflags,Tai_section(hp).secprogbits,Tai_section(hp).name^,Tai_section(hp).secorder)
                  else
                    ObjData.CreateSection(Tai_section(hp).sectype,Tai_section(hp).name^,Tai_section(hp).secorder);

Sven Barth

2019-10-19 17:43

manager   ~0118705

I've fixed this correctly now.

Please test and close if okay.

Do-wan Kim

2019-10-20 01:24

reporter   ~0118719

Thank you!

Issue History

Date Modified Username Field Change
2019-10-14 03:55 Do-wan Kim New Issue
2019-10-14 08:32 Jonas Maebe Note Added: 0118580
2019-10-14 11:00 Do-wan Kim Note Added: 0118581
2019-10-14 11:04 Do-wan Kim Note Edited: 0118581 View Revisions
2019-10-14 15:26 Cyrax Note Added: 0118587
2019-10-14 15:39 Cyrax Note Added: 0118588
2019-10-14 15:42 Cyrax Note Edited: 0118588 View Revisions
2019-10-14 15:44 Cyrax Note Edited: 0118588 View Revisions
2019-10-14 15:46 Cyrax Note Edited: 0118588 View Revisions
2019-10-15 01:23 Do-wan Kim Note Added: 0118607
2019-10-15 04:50 Akira1364 Note Added: 0118609
2019-10-15 04:52 Akira1364 Note Edited: 0118609 View Revisions
2019-10-15 07:03 Do-wan Kim File Added: 36174-assemble.pas.patch
2019-10-15 07:03 Do-wan Kim Note Added: 0118611
2019-10-15 07:08 Akira1364 Note Added: 0118612
2019-10-16 00:25 Cyrax Note Added: 0118627
2019-10-16 02:05 Do-wan Kim Note Added: 0118628
2019-10-16 07:21 Cyrax Note Added: 0118629
2019-10-17 22:41 Sven Barth Note Added: 0118652
2019-10-17 22:56 Akira1364 Note Added: 0118653
2019-10-17 22:57 Akira1364 Note Edited: 0118653 View Revisions
2019-10-18 01:57 Do-wan Kim File Added: 36174-assemble.pas-v2.patch
2019-10-18 01:57 Do-wan Kim Note Added: 0118655
2019-10-19 17:43 Sven Barth Assigned To => Sven Barth
2019-10-19 17:43 Sven Barth Status new => resolved
2019-10-19 17:43 Sven Barth Resolution open => fixed
2019-10-19 17:43 Sven Barth Fixed in Version => 3.3.1
2019-10-19 17:43 Sven Barth Fixed in Revision => 43267
2019-10-19 17:43 Sven Barth FPCTarget => -
2019-10-19 17:43 Sven Barth Note Added: 0118705
2019-10-20 01:24 Do-wan Kim Status resolved => closed
2019-10-20 01:24 Do-wan Kim Note Added: 0118719