This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug go/46986] Go is not supported on Darwin
- From: "afb at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 02 Sep 2011 11:07:33 +0000
- Subject: [Bug go/46986] Go is not supported on Darwin
- Auto-submitted: auto-generated
- References: <bug-46986-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46986
--- Comment #12 from Anders F BjÃrklund <afb at users dot sourceforge.net> 2011-09-02 11:07:33 UTC ---
> It doesn't include the objcopy header,
> but I believe that is skipped anyway ?
Or at least it was *supposed* to ignore it,
but the Stream_from_file was horribly buggy.
(apparently has a dyslectic problem with
comparisons, aggrevated by copy/paste ?)
It always returned "" instead of any data,
so failed to provide the required magic...
(or any other data beyond that, if asked)
Fixing that class, and it works just fine:
Index: gcc/go/gofrontend/import.cc
===================================================================
--- gcc/go/gofrontend/import.cc (revision 178444)
+++ gcc/go/gofrontend/import.cc (working copy)
@@ -836,7 +836,7 @@
bool
Stream_from_file::do_peek(size_t length, const char** bytes)
{
- if (this->data_.length() <= length)
+ if (this->data_.length() >= length)
{
*bytes = this->data_.data();
return true;
@@ -854,7 +854,7 @@
return false;
}
- if (lseek(this->fd_, - got, SEEK_CUR) != 0)
+ if (lseek(this->fd_, - got, SEEK_CUR) < 0)
{
if (!this->saw_error())
error("lseek failed: %m");
@@ -876,7 +876,7 @@
void
Stream_from_file::do_advance(size_t skip)
{
- if (lseek(this->fd_, skip, SEEK_CUR) != 0)
+ if (lseek(this->fd_, skip, SEEK_CUR) < 0)
{
if (!this->saw_error())
error("lseek failed: %m");
That bug should affect any other platform too,
if trying to use "naked" .gox (without object) ?