Skip to content

Support building with GCC v8.x/v9.x #265

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

Closed
wants to merge 4 commits into from

Conversation

dscho
Copy link
Member

@dscho dscho commented Jun 13, 2019

I noticed a while ago that I could not build Git's master in Git for Windows' SDK when using GCC v8.x. This became a much less pressing problem when I discovered a serious bug that would not let us compile with ASLR/DEP enabled (the resulting executables would just throw segmentation faults left and right), so I put these patches on the backburner for a while.

But now GCC v8.x is fixed, and MSYS2 even switched to GCC v9.x (which found yet another problem that I fix in patch 4/4 of this patch series). So it is time to get Git's master ready.

dscho added 4 commits June 13, 2019 12:56
The return type of the `GetProcAddress()` function is `FARPROC` which
evaluates to `long long int (*)()`, i.e. it cannot be cast to the
correct function signature by GCC 8.

To work around that, we first cast to `void *` and go on with our merry
lives.

Signed-off-by: Johannes Schindelin <[email protected]>
The kwset functionality makes use of the obstack code, which expects to
be handed a function that can allocate large chunks of data. It expects
that function to accept a `size` parameter of type `long`.

This upsets GCC 8 on Windows, because `long` does not have the same
bit size as `size_t` there.

Now, the proper thing to do would be to switch to `size_t`. But this
would make us deviate from the "upstream" code even further, making it
hard to synchronize with newer versions, and also it would be quite
involved because that `long` type is so invasive in that code.

Let's punt, and instead provide a super small wrapper around
`xmalloc()`.

Signed-off-by: Johannes Schindelin <[email protected]>
We introduced helper macros to simplify loading functions dynamically.
Might just as well use them.

This also side-steps a compiler warning when building with GCC v8.x: it
would complain about casting between incompatible function pointers.

Signed-off-by: Johannes Schindelin <[email protected]>
The `labs()` function operates, as the initial `l` suggests, on `long`
parameters. However, in `config.c` we tried to use it on values of type
`intmax_t`.

This problem was found by GCC v9.x.

To fix it, let's just "unroll" the function (i.e. negate the value if it
is negative).

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member Author

dscho commented Jun 13, 2019

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 13, 2019

Submitted as [email protected]

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 13, 2019

This branch is now known as js/gcc-8-and-9.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 13, 2019

This patch series was integrated into pu via git@3a9119b.

@gitgitgadget gitgitgadget bot added the pu label Jun 13, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Jun 13, 2019

This patch series was integrated into pu via git@c444961.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 14, 2019

This patch series was integrated into pu via git@ecf0ecc.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 18, 2019

This patch series was integrated into pu via git@19d6d32.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 20, 2019

This patch series was integrated into pu via git@32983d7.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 20, 2019

This patch series was integrated into pu via git@2d469a6.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 21, 2019

This patch series was integrated into pu via git@ecc6479.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 24, 2019

This patch series was integrated into pu via git@21460a6.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 26, 2019

This patch series was integrated into pu via git@431cb85.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 27, 2019

This patch series was integrated into pu via git@8307f7b.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 28, 2019

This patch series was integrated into pu via git@00d3192.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 28, 2019

This patch series was integrated into pu via git@eb1fa43.

@gitgitgadget
Copy link

gitgitgadget bot commented Jun 28, 2019

This patch series was integrated into next via git@92bb0db.

@gitgitgadget gitgitgadget bot added the next label Jun 28, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Jun 28, 2019

This patch series was integrated into pu via git@d8281fa.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 1, 2019

This patch series was integrated into pu via git@4017071.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 2, 2019

This patch series was integrated into pu via git@7734bfb.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 3, 2019

This patch series was integrated into pu via git@184a1fd.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 3, 2019

This patch series was integrated into pu via git@cfa9706.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 9, 2019

This patch series was integrated into pu via git@be21fa8.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 10, 2019

This patch series was integrated into pu via git@7785f9b.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 10, 2019

This patch series was integrated into next via git@7785f9b.

@gitgitgadget
Copy link

gitgitgadget bot commented Jul 10, 2019

This patch series was integrated into master via git@7785f9b.

@gitgitgadget gitgitgadget bot added the master label Jul 10, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Jul 10, 2019

Closed via 7785f9b.

@gitgitgadget gitgitgadget bot closed this Jul 10, 2019
@dscho dscho deleted the gcc-8-and-9 branch July 11, 2019 08:22
dscho added a commit to git-for-windows/git-sdk-32 that referenced this pull request Jul 15, 2019
The issues with GCC have been resolved:

- The bug in GCC v8.x was fixed that prevented
  `-fstack-protector-strong` to produce valid code:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832

- The issues were resolved in Git for Windows' source code that
  triggered build warnings with GCC v8.x (warnings that cause build
  failures with `DEVELOPER=1`):

  git-for-windows/git#2149

- The issue preventing Git for Windows to be compiled with GCC v9.x
  under `DEVELOPER=1` was resolved:

  git-for-windows/git#2258

- The issues preventing Git's `master` to be compiled with GCC v9.x
  (rolling up the fixes for GCC v8.x) were resolved:

  gitgitgadget/git#265

The issue with osslsigncode no longer signing the code after the upgrade
to OpenSSL v1.1.1, but pretending to succeed, has been fixed some time
recently through a rebuild of mingw-w64-osslsigncode.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to git-for-windows/git-sdk-64 that referenced this pull request Jul 15, 2019
The issues with GCC have been resolved:

- The bug in GCC v8.x was fixed that prevented
  `-fstack-protector-strong` to produce valid code:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832

- The issues were resolved in Git for Windows' source code that
  triggered build warnings with GCC v8.x (warnings that cause build
  failures with `DEVELOPER=1`):

  git-for-windows/git#2149

- The issue preventing Git for Windows to be compiled with GCC v9.x
  under `DEVELOPER=1` was resolved:

  git-for-windows/git#2258

- The issues preventing Git's `master` to be compiled with GCC v9.x
  (rolling up the fixes for GCC v8.x) were resolved:

  gitgitgadget/git#265

Signed-off-by: Johannes Schindelin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant