[Bug ld/30375] C++ std::cout's rdbuf gives ridiculous address on windows with dynamic linking with ld

2023-05-11 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30375

Alan Modra  changed:

   What|Removed |Added

   Severity|critical|normal
   Priority|P1  |P2

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/30376] windres cannot parse rc files which it itself generated

2023-05-11 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30376

--- Comment #3 from Nick Clifton  ---
(In reply to Pali Rohár from comment #2)

> 98f2e089891cae87147f74948f694565) for which GNU windres generates shell32.rc
> file with same syntax errors.

Thanks - with that I can reproduce the problem.  (Interestingly some of the
other versions of the shell32.dll file from that site do not exhibit the
problem).


(In reply to Pali Rohár from comment #1)
> i686-w64-mingw32-windres: shell32.rc:6473: syntax error

The problem is this line:

  6472 "REGINST" "REGINST"

The binutils RC parser combines adjacent quoted strings into a single string
with a single space between them, in the same way as the C pre-processor.   So
the parser thinks that a resource called "REGINST REGINST" is being declared
and spaces are not allowed in resource names...

I do not think changing the behaviour of the parser is a good idea, since there
may be projects out there that depend upon the current behaviour.  Instead I am
looking at changing the COFF to RC converter so that it does not emit resource
names enclosed inside quotes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/30376] windres cannot parse rc files which it itself generated

2023-05-11 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30376

--- Comment #4 from Nick Clifton  ---
Created attachment 14876
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14876&action=edit
Proposed patch

OK, here is a possible patch.

With this applied the resource file created from shell32.dll is slightly
different, and when it is converted back into a COFF format file there are no
errors.  There are a few warnings however:

  x86_64-w64-mingw32-windres: warning: 14: 1001: 1033: duplicate value
  x86_64-w64-mingw32-windres: warning: 14: 1002: 1033: duplicate value
  x86_64-w64-mingw32-windres: warning: 14: 1003: 1033: duplicate value
  x86_64-w64-mingw32-windres: warning: 14: 1004: 1033: duplicate value
  x86_64-w64-mingw32-windres: warning: 14: 1005: 1033: duplicate value

I am not sure if these pose a real problem however.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/30376] windres cannot parse rc files which it itself generated

2023-05-11 Thread pali at kernel dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=30376

--- Comment #5 from Pali Rohár  ---
Finally I found documentation about named resources which caused this issue:
https://learn.microsoft.com/en-us/windows/win32/menurc/user-defined-resource

And here there is no information that name or type should be quoted. Also in
example is both name and type unquoted.

So I did an experiment with simple RC file:

$ cat RESOURCE.RC
resource_name resource_type { "resource_string_data" }

I compiled it with MS resource compiler RC.EXE to RESOURCE.RES file:

$ RC.EXE RESOURCE.RC

It accepted it and did not print any warning / error.

Then I created resource-only DLL with the linker script which you provided:

$ i686-w64-mingw32-windres RESOURCE.RES RESOURCE.OBJ
$ i686-w64-mingw32-ld -dll --subsystem windows -e 0 -s RESOURCE.OBJ -o
RESOURCE.DLL -T resource-only.ld

And then printed resources via wrestool:

$ wrestool -l RESOURCE.DLL
--type='RESOURCE_TYPE' --name='RESOURCE_TYPE' --language=1033 [offset=0x1090
size=20]

(I'm not sure why it prints wrong name, but whatever).

Next I did another experiment with following resource file, when I quoted name
and type:

$ cat RESOURCE.RC
"resource_name" "resource_type" { "resource_string_data" }

And again compiled it with MS RC.EXE compiler and created resource-only DLL
with GNU tools. MS compiler accepted this input file without any warning or
error. And wrestool showed:

$ wrestool -l RESOURCE.DLL
--type='"RESOURCE_TYPE"' --name='"RESOURCE_TYPE"' --language=1033
[offset=0x1098 size=20]

Look at the type, it is quited. So it looks like that name in RC file should be
taken as-is, if it contains quotes then quotes are part of the name. And it
means that GNU windres does not generate correct RC file and also does not
parse  RC file correctly.

I will try your windres patch later and let you know the results.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/30409] mingw ar broken since binutils 2.33

2023-05-11 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30409

--- Comment #3 from Alan Modra  ---
Unsurprisingly, ar compiled on a linux host (bith 32 and 64 bit) for a mingw
target shows no problem handling this testcase, and I don't have a windows box
with mingw installed to check for host specific ar bugs.

One of the things that did change in binutils after 2.32 was the temporary file
creation and renaming of the output file.  Those changes may have exposed mingw
bugs.

Also, have you verified that running the ar commands by hand creates the same
broken archives?

-- 
You are receiving this mail because:
You are on the CC list for the bug.