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

runtime/cgo: added missing includes for errno.h to the windows gcc stubs. #28747

Closed
wants to merge 1 commit into from

Conversation

arizvisa
Copy link
Contributor

This adds the includes for errno.h to the windows stubs
for runtime/cgo so that "errno" is properly declared.

Due to "errno" not being properly declared, the compiler is
forced to assume it's an external which leaves it up to the
linker. This is an issue in some implementations as errno
might be a macro which results in an unresolved symbol error
during linking.

runtime/cgo/gcc_libinit_windows.c: added include
runtime/cgo/gcc_windows_386.c: added include
runtime/cgo/gcc_windows_amd64.c: added include

…ubs.

This adds the includes for errno.h to the windows stubs
for runtime/cgo so that "errno" is properly declared.

Due to "errno" not being properly declared, the compiler is
forced to assume it's an external which leaves it up to the
linker. This is an issue in some implementations as errno
might be a macro which results in an unresolved symbol error
during linking.

runtime/cgo/gcc_libinit_windows.c: added include
runtime/cgo/gcc_windows_386.c: added include
runtime/cgo/gcc_windows_amd64.c: added include
@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Nov 12, 2018
@gopherbot
Copy link

This PR (HEAD: 90da06e) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/149118 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link

Message from Brad Fitzpatrick:

Patch Set 1:

What are "some implementations"?


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ali Rizvi-Santiago:

Patch Set 1:

Patch Set 1:

What are "some implementations"?

msys2 (uname -a MSYS_NT-6.3 skinny 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys) is just one example which can declare errno in sys/errno.h as:

#ifndef _REENT_ONLY
#define errno (*__errno())
extern int *__errno (void);
#endif

But one thing which is weird is that "errno.h" is included in all the other stubs except for the 3 in this patch (for some reason). Wasn't sure why it was skipped for these because it's essentially not declaring errno.


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ali Rizvi-Santiago:

Patch Set 1:

Patch Set 1:

Patch Set 1:

What are "some implementations"?

msys2 (uname -a MSYS_NT-6.3 skinny 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys) is just one example which can declare errno in sys/errno.h as:

#ifndef _REENT_ONLY
#define errno (*__errno())
extern int *__errno (void);
#endif

But one thing which is weird is that "errno.h" is included in all the other stubs except for the 3 in this patch (for some reason). Wasn't sure why it was skipped for these because it's essentially not declaring errno.

Another C standard library that declares errno as a macro seems to be openwatcom (although it's not like it's supported by golang):
http://svn.netlabs.org/repos/gl2/include/errno.h

Really, though, it's just not correct to use errno before declaring it as it's relying entirely on a compiler assumption. Although pretty much all compilers will just throw a warning and assume you're specifying an external, it's really up to the standard library for how to handle errno.


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 1: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Gobot Gobot:

Patch Set 1:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=6e6e5202


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Gobot Gobot:

Patch Set 1: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Nov 12, 2018
…ubs.

This adds the includes for errno.h to the windows stubs
for runtime/cgo so that "errno" is properly declared.

Due to "errno" not being properly declared, the compiler is
forced to assume it's an external which leaves it up to the
linker. This is an issue in some implementations as errno
might be a macro which results in an unresolved symbol error
during linking.

runtime/cgo/gcc_libinit_windows.c: added include
runtime/cgo/gcc_windows_386.c: added include
runtime/cgo/gcc_windows_amd64.c: added include

Change-Id: I77167d02f7409462979135efc55cf50bbc6bd363
GitHub-Last-Rev: 90da06e
GitHub-Pull-Request: #28747
Reviewed-on: https://go-review.googlesource.com/c/149118
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 1: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/149118.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

This PR is being closed because golang.org/cl/149118 has been merged.

@gopherbot gopherbot closed this Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants