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

fix gcc5 build #55

Merged
merged 1 commit into from Jul 6, 2015
Merged

fix gcc5 build #55

merged 1 commit into from Jul 6, 2015

Conversation

xantares
Copy link
Contributor

gcc 4.6.4 must be patched in order to compile with gcc 5.1.0:
DragonFlyBSD/DPorts#136

@liclac
Copy link
Contributor

liclac commented Jun 13, 2015

Any chance we could update our GCC fork, instead of maintaining this old version? (ping @artart78)

@MrColdbird
Copy link

There is more to fix than just this gcc 5.1.0 issue actually.

The produced static libraries don't export the _link symbol, which in turn makes every application that links to the libc / libstdc++ part of those fail to build.

A makeshift way of getting this sorted is to add a dummy _link syscall to the source before building, a sample patch has been posted here:

https://sourceware.org/ml/newlib/2000/msg00401.html

@xantares
Copy link
Contributor Author

xantares commented Jul 2, 2015

@MrColdbird the patch you point out doesn't change anything, _link is already defined here in newlib 1.20.0:

int
_close (int file)
{
  return __trap34 (SYS_close, file, 0, 0);
}

int
_link (char *old, char *new)
{
  return -1;
}

caddr_t
_sbrk (int incr)

@MrColdbird
Copy link

Then we need an explanation why this particular piece isn't getting linked in as a separate symbol.
Do you think a compiler optimization might have inlined this in a bad way?

@xantares
Copy link
Contributor Author

xantares commented Jul 2, 2015

got it, it's because of the patch, _link is found in newlib/libc/sys/psp/libcglue.c:

#ifdef F__link
int _link(const char *name1, const char *name2)
{
        errno = ENOSYS;
        return -1; /* not supported */
}
#endif

and F__link is not defined anywhere
if I add -DF__link to CFLAGS I got:

$ nm /usr/psp/lib/libc.a --defined-only | grep _link
00000000 T _link
000000bc T _link
00000000 T _link
00000000 T _link
00000198 T _link
00000000 T _link
00000000 T _link
00000000 T _link
00000000 T _link
0000009c T _link
00000000 T _link
00000000 T _link
00000000 T _link
00000000 T _link
00000000 T _link
00000000 T _link_r
00000000 T _link
00000138 T _link
00000074 T _link
00000000 T _link
00000000 T _link
00000000 T _link
000001fc T _link
00000060 T _link
00000000 T _link
000001c0 T _link
000000bc T _link
00000000 T _link
00000068 T _link
00000000 T _link
00000000 T _link
00000000 T _link
time.o_link.o:
00000000 T _link
00000000 T _link
00000000 T _link
00000068 T _link
00000000 T _link
000001c0 T _link

@MrColdbird
Copy link

Sweet. Hope to see a commit on your github with it soon then so I can pull it in via your Arch package later today.

@xantares
Copy link
Contributor Author

xantares commented Jul 2, 2015

unfortunately i get an error caused by multiple references to _link at final build

@xantares
Copy link
Contributor Author

xantares commented Jul 2, 2015

@xantares
Copy link
Contributor Author

xantares commented Jul 2, 2015

see #56, it's another unrelated issue

@xantares
Copy link
Contributor Author

xantares commented Jul 2, 2015

@artart78, @uppfinnarn, this one can be merged now, along with #56

@MrColdbird
Copy link

Nicely done.

@artart78
Copy link
Member

artart78 commented Jul 6, 2015

@uppfinnarn, I tried to update the patch to the latest binutils / gcc versions, but IIRC binutils changed to much for the patch to be adapted. Some parts of it probably would need to be rewritten from scratch, and I don't think it's worth it.

Thanks for the fixes @xantares !

artart78 added a commit that referenced this pull request Jul 6, 2015
@artart78 artart78 merged commit f61857e into pspdev:master Jul 6, 2015
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.

None yet

4 participants