Can somebody explain me why this (the text starting at the red arrow) is compiled to the executable?
Is this important to execute the program properly? If not, how can I tell the compiler not to add the text?
Screenshot is from Windows exe.
Thanks
GCC compiler question
GCC compiler question
Last edited by UEZ on Mar 29, 2019 12:34, edited 1 time in total.
Re: GCC compiler question
Each compilation module (.o) has such identifier, and is either in a keep section, or referenced by something (debug info, is it stripped?)
Probably they all get tossed into the same section, so are in the same general part of the binary. Can be used that they are all sjlj and same version of mingw.
Might also be that these are weak or so on *nix, but don't get deduplicated on PE/windows.
Probably they all get tossed into the same section, so are in the same general part of the binary. Can be used that they are all sjlj and same version of mingw.
Might also be that these are weak or so on *nix, but don't get deduplicated on PE/windows.
Re: GCC compiler question
UEZ
As an observation only:
I have also noticed the repeats of this string in the .exe file.
Even in the tiny shell64.exe from (shell "cmd" as the .bas file) gives me 24 repeats.
Larger .exe files (64 bit) give many more repeats.
The -gen gas equivalent string is "GCC: (i686-win32-sjlj-rev0, Built by MinGW-W64 project)"
I get
(Win 10)
with fb 1.06 official build.
The equivalent Pascal .exe file has this as the last few string entries
...
msvcrt.dll kernel32.dll oleaut32.dll user32.dll
but no repeat strings.
But is 42 kb (fb is 24 kb)
As an observation only:
I have also noticed the repeats of this string in the .exe file.
Even in the tiny shell64.exe from (shell "cmd" as the .bas file) gives me 24 repeats.
Larger .exe files (64 bit) give many more repeats.
The -gen gas equivalent string is "GCC: (i686-win32-sjlj-rev0, Built by MinGW-W64 project)"
Code: Select all
Function tally(somestring As String,partstring As String) As Integer
Dim As Integer i,j,ln,lnp,count,num
ln=Len(somestring)
lnp=Len(partstring)
count=0
i=-1
Do
i+=1
If somestring[i] <> partstring[0] Then Goto skip
If somestring[i] = partstring[0] Then
For j=0 To lnp-1
If somestring[j+i]<>partstring[j] Then Goto skip
Next j
End If
count+=1
i=i+lnp-1
skip:
Loop Until i>=ln-1
Return count
End Function
#Include "file.bi"
Function loadfile(file as string) as String
If FileExists(file)=0 Then Print file;" not found":Sleep:end
var f=freefile
Open file For Binary Access Read As #f
Dim As String text
If Lof(f) > 0 Then
text = String(Lof(f), 0)
Get #f, , text
End If
Close #f
return text
end Function
var L=loadfile("C:\Users\User\Desktop\shell64.exe")
print "File length ";len(L)
print "Repititions ";tally(L,"GCC: (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project)")
sleep
Code: Select all
File length 24064
Repititions 24
with fb 1.06 official build.
The equivalent Pascal .exe file has this as the last few string entries
...
msvcrt.dll kernel32.dll oleaut32.dll user32.dll
but no repeat strings.
But is 42 kb (fb is 24 kb)
Re: GCC compiler question
Apparently the length depends on the exe size. The larger the file the more repetitions exist.
Code: Select all
#Include "file.bi"
Function tally(somestring As String,partstring As String) As Integer
Dim As Integer i,j,ln,lnp,count,num
ln=Len(somestring)
lnp=Len(partstring)
count=0
i=-1
Do
i+=1
If somestring[i] <> partstring[0] Then Goto skip
If somestring[i] = partstring[0] Then
For j=0 To lnp-1
If somestring[j+i]<>partstring[j] Then Goto skip
Next j
End If
count+=1
i=i+lnp-1
skip:
Loop Until i>=ln-1
Return count
End Function
Function loadfile(file As String) As String
If Fileexists(file)=0 Then Print file;" Not found":Sleep:End
Var f=Freefile
Open file For Binary Access Read As #f
Dim As String text
If Lof(f) > 0 Then
text = String(Lof(f), 0)
Get #f, , text
End If
Close #f
Return text
End Function
Var L=loadfile("Test08.exe")
Dim As String s1 = "GCC: (i686-posix-sjlj-rev0, Built by MinGW-W64 project) 4.9.3", _
s2 = "GCC: (i686-win32-sjlj-rev0, Built by MinGW-W64 project) 5.2.0"
Print "File length ";Len(L)
Print
Dim As Ulong l1 = tally(L, s1), l2 = tally(L, s2)
Print s1
Print "Repititions ";l1
Print
Print s2
Print "Repititions ";l2
Print
Print "Overall string length in bytes: " & Len(s1) * l1 + Len(s2) * l2
Print "Overall incl. 3 null chars between = " & Len(s1) * l1 + Len(s2) * l2 + (l1 + l2 - 1) * 24
Sleep