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

ppc64 and building with newer gcc? #655

Open
barracuda156 opened this issue Jun 13, 2022 · 17 comments
Open

ppc64 and building with newer gcc? #655

barracuda156 opened this issue Jun 13, 2022 · 17 comments

Comments

@barracuda156
Copy link

@classilla Do you know if it is hard to allow building TFF with a newer version of gcc than 4.8? @kencu confirms here that later versions failed, at least for Intel: iains/gcc-10-branch#7 (comment)
At the moment, we got gcc10 and gcc11 available for PPC, via Macports (not yet officially supported, but they work perfectly) or standalone (from @iains branches). Would be nice if TFF builds with these.

The second question is re ppc64 support, raised here: https://forums.macrumors.com/threads/llvm-and-ld64-for-ppc64-on-leopard.2336740/?post=31178811#post-31178811
From what I understand, TFF is 32-bit for PPC? Is there some inherent issue preventing ppc64 build, or it simply has not been tested?

@kencu
Copy link
Contributor

kencu commented Jun 13, 2022

the newer gcc issues were being tracked here #464 but we stopped a few years ago, so nobody tried gcc10 or gcc11.

@iains
Copy link

iains commented Jun 13, 2022

note that TFF has "10.4" in the title, and 10.4 has very little support for ppc64 (essentially nothing beyond the base libs; no frameworks, no objc .. ) so I would not expect something targeting 10.4 to be useful for a ppc64 case.

@barracuda156
Copy link
Author

note that TFF has "10.4" in the title, and 10.4 has very little support for ppc64 (essentially nothing beyond the base libs; no frameworks, no objc .. ) so I would not expect something targeting 10.4 to be useful for a ppc64 case.

@iains Honestly I don’t know if support for 10.4 implies that ppc64 variant should be impossible. Included profiles to be used for the build have dedicated G5 versions: https://github.com/classilla/tenfourfox/blob/master/G5.mozcfg
But those nevertheless use -m32 flags.

@classilla
Copy link
Owner

I don't know, I've never tried personally. The reason the G5 version is built in 32-bit mode is because of the JIT, which definitely won't work in 64-bit mode (also, assuming you're building this for Mac OS X, TenFourFox has some legacy Carbon code).

@barracuda156
Copy link
Author

I don't know, I've never tried personally. The reason the G5 version is built in 32-bit mode is because of the JIT, which definitely won't work in 64-bit mode (also, assuming you're building this for Mac OS X, TenFourFox has some legacy Carbon code).

@classilla Thank you! The JIT is this one? js/src/jit/osxppc
Given that neighboring mips has both 32- and 64-bit versions, I would imagine ppc64 to be feasible, though I dunno how much effort that could require.

@classilla
Copy link
Owner

It would need to be written from scratch. The one I'm writing for POWER9 is little-endian and specific to that ISA level.

@barracuda156
Copy link
Author

It would need to be written from scratch. The one I'm writing for POWER9 is little-endian and specific to that ISA level.

@classilla Oh… I had an impression that as far as Darwin goes, ppc and ppc64 aren’t hugely different. Few assembler instructions should be replaced, in a predictable fashion, and maybe handling of 64-bit numbers (takes more instructions on ppc32?). ABI documentation does not seem to suggest huge differences. Well, r13 is used for some thread-related stuff on ppc64.

But @iains noted earlier that Apple documentation is incomplete, so I guess I miss something here.

@kencu
Copy link
Contributor

kencu commented Jun 14, 2022

it’s not the toolchain exactly, or Apple documentation, or ABI.

the code itself has conditional compilation for systems, endianness, and bit depth. All different paths.

a pathway for darwin big endian 64bit was never written into the code, far as I recall it.

@iains
Copy link

iains commented Jun 14, 2022

it’s not the toolchain exactly, or Apple documentation, or ABI.

the code itself has conditional compilation for systems, endianness, and bit depth. All different paths.

a pathway for darwin big endian 64bit was never written into the code, far as I recall it.

To avoid any confusion : PowerPC Darwin is always Big Endian (32 and 64B),

AFAIK the only LE Power systems are ELF (v2) and for Power >= 9 (ICBW, maybe Power 8 is also covered).

@kencu
Copy link
Contributor

kencu commented Jun 14, 2022

yeah, pre-coffee brainfart after reading Cameron's comment; I changed it to BE 10 seconds after I wrote that, and went 'What -- no'. :>

@classilla
Copy link
Owner

By 'from scratch' I mean it's probably a bit more than a few tweaks or other trivial changes. Yes, the code runs on the 970 except for things like mcrxr. However, it is inherently 32-bit, all calling conventions are 32-bit, JIT entry and exit uses 32-bit, etc. There are also relatively few 64-bit operations that the JIT performs that would benefit. Even current versions of Firefox mostly deal in 32-bit ints other than bignums, which TenFourFox's JavaScript doesn't support.

The POWER9 JIT (for the record, POWER8 also supports LE, POWER7 sort of) is fully 64-bit. Some code was used as a template, but it's been almost completely redone to make it 64-bit clean. Even then I'm still banging bugs out of it, mostly with sign extension and 32-bit thunking.

@barracuda156
Copy link
Author

The POWER9 JIT (for the record, POWER8 also supports LE, POWER7 sort of) is fully 64-bit. Some code was used as a template, but it's been almost completely redone to make it 64-bit clean. Even then I'm still banging bugs out of it, mostly with sign extension and 32-bit thunking.

@classilla Why a choice of LE btw? All POWER CPUs support BE.

@classilla
Copy link
Owner

Largely convenience. There are relatively few Linux distros that still offer spins with BE support, and they tend to be more fringe. Plus, TenFourFox has a lot of hacks for a Web that now assumes little-endian (little endian typed array emulation being the most notable). I like BE personally and when I upgrade my server to POWER whatever-is-current I'll probably try to run it big with FreeBSD or something, but the desktop experience is better with Linux IMHO, and it's just simpler to run it LE.

@barracuda156
Copy link
Author

I like BE personally and when I upgrade my server to POWER whatever-is-current I'll probably try to run it big with FreeBSD or something, but the desktop experience is better with Linux IMHO, and it's just simpler to run it LE.

I am planning to install FreeBSD 13 as a second system into my G5 Quad in fact. There is a nice GUI for FreeBSD, quite MacOS-like: https://github.com/helloSystem

P. S. From what I understand, even ELF2 can be used in BE mode. No good reason to downgrade to LE.

@barracuda156
Copy link
Author

@classilla Not to create a separate topic: does TFF use v8-related or similar code? I am trying to fix nodejs12 for Darwin PPC :)

@classilla
Copy link
Owner

No, it doesn't use V8.

@barracuda156
Copy link
Author

@classilla A bit offtop, just want to share a success: just built tenfourfox on 10.6 PPC in Macports (I have adapted an earlier work of @kencu to PPC).

P. S. Just noticed my RAM got cooked – been wondering why is it so slow LOL
TFF_10 6

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

No branches or pull requests

4 participants