Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msys2 3.3.6 binutils fixes #203

Merged
merged 4 commits into from
Feb 23, 2024

Conversation

jeremyd2019
Copy link
Member

@jeremyd2019 jeremyd2019 commented Feb 20, 2024

Fixes #200

Wound up having to backport more fixes for binutils than I expected, to get dumper.exe included again.

Corinna suggested in https://cygwin.com/pipermail/cygwin/2024-February/255472.html that there was probably no good reason for _cygheap_start being in .rsrc instead of .cygheap section, so moved it. This at least works well enough to run and update other packages on both i686 and x86_64, so is definitely an improvement on the old behavior of crashing immediately.

As I mentioned in the commit message, this may result in reducing the difference between _cygheap_start and _cygheap_end by the fraction of a page not used in the .rsrc section. This works out to moving _cygheap_start forward by 3064 bytes on i686, from 0x408 bytes into the .rsrc page to the start of the .cygheap section, which should have reduced the difference between _cygheap_end and _cygheap_start from 2137080 to 2134016 bytes. But for some reason, in practice this difference is now 2138112 bytes.

On x86_64, the used portion of .rsrc is also 0x408 bytes, and the difference between end and start went from 3210232 to 3182592 bytes.

jeremyd2019 and others added 4 commits February 20, 2024 10:18
Binutils >= 2.41 started making .rsrc section read-only, which caused
memset(_cygheap_start, ...) to segfault.  Instead, put _cygheap_start in
the .cygheap section, which makes more sense anyway, but may result in
reducing the difference between _cygheap_start and _cygheap_end by the
fraction of a page not used in the .rsrc section.

Fixes msys2#200
See-also: https://cygwin.com/pipermail/cygwin/2024-February/255472.html
Signed-off-by: Jeremy Drake <github@jdrake.com>
Also allow that linkage to be dynamic, as libzstd-devel doesn't
currently provide a static library.

(cherry picked from commit 1387ea9)
Rather than guessing, based on just the presence of libbfd, add an
explicit configuration option, to build dumper or not, defaulting to
building it.

This might have some use when bootstrapping Cygwin for a new
architecture, or when building your own Cygwin-targetted cross-compiler,
rather than installing one from the copr, along with the dependencies of
libbfd.

(cherry picked from commit 1b5fc91)
(cherry picked from commit d7a76c6)
The `bfd.h` header file that is included in `binutils` has the line
`#include "ansidecl.h"`, which is fragile because it prefers Cygwin's
`include/ansidecl.h` (as opposed to `#include <ansidecl.h>`, which would
only look in the system include paths).

This matters because as of v2.42, `bfd.h` also makes use of the
`ATTRIBUTE_WARN_UNUSED_RESULT` macro.

So let's just copy that macro (and while at it, the other `ATTRIBUTE_*`
macros) from binutils' `ansidecl.h` file, to avoid compile errors while
compiling `dumper.o` that look like this:

  /usr/include/bfd.h:2770:1: error: expected initializer before ‘ATTRIBUTE_WARN_UNUSED_RESULT’
   2770 | ATTRIBUTE_WARN_UNUSED_RESULT;
        | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
(cherry picked from commit 44b5e4e)
@lazka
Copy link
Member

lazka commented Feb 21, 2024

lgtm

@lazka lazka merged commit 5d96b10 into msys2:msys2-3_3_6-release Feb 23, 2024
1 check passed
@jeremyd2019 jeremyd2019 deleted the msys2-3_3_6-binutils-fix branch February 23, 2024 18:25
jeremyd2019 added a commit to jeremyd2019/MSYS2-packages that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

msys2-runtime-3.3 binaries no longer work
4 participants