44 Commits
Author SHA1 Message Date
Neo a970e3af17 Merge pull request #42 from clang-retro/claude/project-thread-k44b6o
Add build-sysroot.sh: a ready-made classic Mac OS sysroot
2026-11-28 13:17:37 -08:00
Neo-DesktopandClaude Opus 5.5 c2e4767406 Add build-sysroot.sh: a ready-made classic Mac OS sysroot
build-sysroot.sh builds one directory with all that is necessary to
compile and link applications for 68k and PowerPC: the Toolbox headers,
the builtins (libmacrt.a), picolibc and the Mac layer (libc.a,
libmacos.a, libmacconsole.a), and libstdc++, libsupc++ and libunwind
when GCC_SRC is set. It also has macapp.py, the linkers, the CPU
emulators, the examples and the license of each part. macapp.py finds
include/ and lib/ in the directory above its own, so it works in the
sysroot without this source tree.

tests/sysroot.sh builds the examples and the libc, thread, socket, Open
Transport and C++ tests with the sysroot only, and runs them as a 68000,
a 68020 and a PowerPC in sim68k.py and simppc.py. CI runs it.

docs/sysroot.md tells how to get, use and build the sysroot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRVa9XHXnwA5L6Sjog3
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
2026-11-28 20:58:18 +00:00
NeoandClaude Opus 5.5 7ba5f78ac6 Open Transport, MacTCP and Shared Library Manager support for 68k and PowerPC (#38)
Adds the Open Transport and MacTCP name resolver headers and calls on
both CPUs, a Shared Library Manager client on 68k, native Open
Transport on 68k through ASLM with a MacTCP fallback, a fetch sample,
a QEMU network test script and docs.

Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRU3QJgPHoQrF9EQ8YZ
2026-11-28 12:37:26 -08:00
NeoandClaude Opus 5.5 58de736f38 QuickTime: write the definitions from Inside Macintosh, not Apple's headers (#41)
defs/QuickTime.yaml came from tools/mpw2defs.py, which read Apple's
QuickTime 1.5 C interfaces. Those cannot be passed on. The file now
follows Inside Macintosh: QuickTime and Inside Macintosh: QuickTime
Components (1993):

- Each call, record, type and constant in the file is one that the
  books document. The parameter names are the books'.
- The 68k code of each call and the record layouts are interface facts,
  checked against QuickTime 1.5; they do not change.
- What the books do not document is removed: 15 calls (such as
  SetMovieDefaultDataRef and MCRemoveMovie), the 42 movie file atom
  records of MoviesFormat.h, 3 typedefs and 60 constants.

The header tests and the examples build (tests/run.sh). The README says
where the definitions come from, and mpw2defs.py is now a local check
whose output must not be committed.



Claude-Session: https://claude.ai/code/session_01B82eRQpCyeZpKgWB2r7xwi

Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 10:38:55 -08:00
NeoandClaude Opus 5.5 9ec8909672 peflink: discard the DWARF sections of objects built with -g (#40)
With -g, clang puts DWARF debug sections (STYP_DWARF) in the XCOFF
objects. peflink.py gave each relocation of every section to a csect,
and stopped with "relocation at 0x6 is outside every csect" on the
first relocation of .dwinfo.

PEF has no place for debug information, so read the relocations of the
loaded sections (.text, .data and .bss) only. A program built with -g
now links to the same PEF as without -g. tests/run.sh checks this.


Claude-Session: https://claude.ai/code/session_01B82eRTvquw9d1RRGdo1Pyv

Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 09:41:07 -08:00
NeoandClaude Opus 5.5 41cdb06464 libc: getentropy, and a fine clock for CLOCK_MONOTONIC and the sleeps (#39)
getentropy was declared but missing, so arc4random and
std::random_device could not link. runtime/libc/random.c now gives it:
a 32-byte pool mixed with SHA-256 from the jitter of the fine clock
against a counted loop, the clocks, the mouse, the keyboard map and
memory addresses. Each call stirs the pool, hashes the output from it,
and replaces it. A program's own getentropy still replaces it.

CLOCK_MONOTONIC, clock_getres, nanosleep, usleep and the fractions of
gettimeofday now use a fine clock in microseconds: UpTime (looked up in
DriverServicesLib at run time, so NuBus Power Macs still load), else
Microseconds, else TickCount on System 6. Before, they stepped in
ticks (1/60 second).

libstdc++ is configured with getentropy and arc4random, so
std::random_device is no longer a fixed mt19937.

The simulators fake Microseconds, UpTime and AbsoluteToNanoseconds;
simppc.py --nubus leaves DriverServicesLib out, and sim68k.py
--system6 makes _Microseconds unimplemented. tests/libc.c and
tests/cxx.cpp check the new functions.


Claude-Session: https://claude.ai/code/session_01B82eRRKT8Sdxtct21ACSJz

Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 06:23:21 -08:00
NeoandClaude Opus 5.5 02c9821f88 libc: list a folder on another volume correctly (opendir with a full path) (#37)
* Declare the Control Strip calls and the suspend/resume constants

ControlStrip.h declares SBIsControlStripVisible and
SBShowHideControlStrip (trap 0xAAF2, selector in D0) and the Gestalt
selector 'sdev'. ControlStripLib becomes a weak import, so that a
PowerPC program still loads on a Mac without the Control Strip.
OSEvent.h gets suspendResumeMessage, resumeFlag and convertClipboardFlag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* simppc: FindSymbol gives cfragNoSymbolErr for a missing GL name

The fake OpenGLLibrary found every name that starts with "gl" or
"agl". Thus a program could not see that a function is missing, and
the MFC gltest check wglGetProcAddress("glNoSuchFunctionXYZ") == NULL
failed. Now FindSymbol finds only the functions that the fake runs or
that the SDK's OpenGL headers declare.

The Code Fragment Manager error codes (cfragNoSymbolErr and the
others, -2800 to -2899) are now in CodeFragments.h. tests/gl.c checks
that FindSymbol of a missing name gives cfragNoSymbolErr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* malloc: take a large block from temporary memory when the heap is full

On System 7.6.1 at 1152x870, the 3D Maze saver quit at once: its 8 MB
partition had no room for the OpenGL buffers of the whole screen.

When NewPtr fails for a block of 64 KB or more, malloc and calloc now
take the block from temporary memory (TempNewHandle, locked), if
Gestalt says that the system has temporary memory that it frees when
the program quits. free, realloc and malloc_usable_size know these
blocks.

sim68k.py and simppc.py fake TempNewHandle, HLock and HUnlock, with
8 MB of temporary memory after the Mac's memory, and 'os  ' in
Gestalt. tests/libc.c allocates a block larger than the 68k heap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* libc: give the real volume of a full path in the catalog calls

GetCatInfo does not set ioVRefNum, so opendir kept 0, the current
volume. readdir then looked for the folder's directory ID on that
volume. When the current folder was on another disk (a program run
from a CD), a listing of the System Folder's Fonts folder gave no
items. __mac_cat_info now finds the volume of a full path by its name
with HGetVInfo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* tests: read each volatile once in the shift64 check

A newer clang warns (-Wunsequenced-volatile, an error with -Werror)
when one expression reads a volatile twice without a sequence point.
The check now compares with the constant values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-27 12:48:06 -08:00
NeoandClaude Opus 5.5 6810ae000e malloc: take a large block from temporary memory when the heap is full (#36)
* Declare the Control Strip calls and the suspend/resume constants

ControlStrip.h declares SBIsControlStripVisible and
SBShowHideControlStrip (trap 0xAAF2, selector in D0) and the Gestalt
selector 'sdev'. ControlStripLib becomes a weak import, so that a
PowerPC program still loads on a Mac without the Control Strip.
OSEvent.h gets suspendResumeMessage, resumeFlag and convertClipboardFlag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* simppc: FindSymbol gives cfragNoSymbolErr for a missing GL name

The fake OpenGLLibrary found every name that starts with "gl" or
"agl". Thus a program could not see that a function is missing, and
the MFC gltest check wglGetProcAddress("glNoSuchFunctionXYZ") == NULL
failed. Now FindSymbol finds only the functions that the fake runs or
that the SDK's OpenGL headers declare.

The Code Fragment Manager error codes (cfragNoSymbolErr and the
others, -2800 to -2899) are now in CodeFragments.h. tests/gl.c checks
that FindSymbol of a missing name gives cfragNoSymbolErr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* malloc: take a large block from temporary memory when the heap is full

On System 7.6.1 at 1152x870, the 3D Maze saver quit at once: its 8 MB
partition had no room for the OpenGL buffers of the whole screen.

When NewPtr fails for a block of 64 KB or more, malloc and calloc now
take the block from temporary memory (TempNewHandle, locked), if
Gestalt says that the system has temporary memory that it frees when
the program quits. free, realloc and malloc_usable_size know these
blocks.

sim68k.py and simppc.py fake TempNewHandle, HLock and HUnlock, with
8 MB of temporary memory after the Mac's memory, and 'os  ' in
Gestalt. tests/libc.c allocates a block larger than the 68k heap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-27 07:07:56 -08:00
NeoandClaude Opus 5.5 cf093c43dd simppc: FindSymbol gives cfragNoSymbolErr for a missing GL name (#35)
* Declare the Control Strip calls and the suspend/resume constants

ControlStrip.h declares SBIsControlStripVisible and
SBShowHideControlStrip (trap 0xAAF2, selector in D0) and the Gestalt
selector 'sdev'. ControlStripLib becomes a weak import, so that a
PowerPC program still loads on a Mac without the Control Strip.
OSEvent.h gets suspendResumeMessage, resumeFlag and convertClipboardFlag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* simppc: FindSymbol gives cfragNoSymbolErr for a missing GL name

The fake OpenGLLibrary found every name that starts with "gl" or
"agl". Thus a program could not see that a function is missing, and
the MFC gltest check wglGetProcAddress("glNoSuchFunctionXYZ") == NULL
failed. Now FindSymbol finds only the functions that the fake runs or
that the SDK's OpenGL headers declare.

The Code Fragment Manager error codes (cfragNoSymbolErr and the
others, -2800 to -2899) are now in CodeFragments.h. tests/gl.c checks
that FindSymbol of a missing name gives cfragNoSymbolErr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-27 05:55:29 -08:00
NeoandClaude 97244cf339 Auto-assign new issues to Neo-Desktop (#34)
Add a workflow that adds Neo-Desktop as an assignee when an issue
is opened.


Claude-Session: https://claude.ai/code/session_01B82eRQqxennD6yGZo4WkoY

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-26 18:29:54 -08:00
Neo 9942b81e59 Merge pull request #33 from clang-retro/claude/project-thread-hd700l
Make code resources and background applications with macapp.py
2026-11-26 12:03:50 -08:00
NeoandClaude d9bba62662 Declare the Control Strip calls and the suspend/resume constants (#32)
ControlStrip.h declares SBIsControlStripVisible and
SBShowHideControlStrip (trap 0xAAF2, selector in D0) and the Gestalt
selector 'sdev'. ControlStripLib becomes a weak import, so that a
PowerPC program still loads on a Mac without the Control Strip.
OSEvent.h gets suspendResumeMessage, resumeFlag and convertClipboardFlag.


Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 21:26:10 -08:00
Neo a9a5bb7428 Merge pull request #31 from clang-retro/claude/project-thread-8qcwxr
runtime: 68000 assembly soft float for single precision
2026-11-25 21:07:44 -08:00
Neo 181798410d Merge pull request #30 from clang-retro/claude/project-thread-ws9uve
Open a resource fork with the path suffix /..namedfork/rsrc
2026-11-25 20:24:58 -08:00
Neo 00bc24d483 Merge pull request #29 from clang-retro/claude/project-thread-ws9uve
Fake the menu bar calls in the simulators
2026-11-25 18:42:08 -08:00
Neo ed958891a6 Merge pull request #28 from clang-retro/claude/project-thread-ws9uve
Keep Toolbox calls apart from program functions of the same name
2026-11-25 18:05:55 -08:00
Neo b86d5967d8 Merge pull request #27 from clang-retro/claude/project-thread-ws9uve
Add ftime to the C library
2026-11-25 13:53:01 -08:00
Neo 7d46fb4536 Merge pull request #26 from clang-retro/claude/project-thread-ws9uve
Add Quesa (QuickDraw 3D over OpenGL) for PowerPC, and Carbon accessors
2026-11-25 12:03:36 -08:00
Neo dfc98cce81 Merge pull request #25 from clang-retro/claude/project-thread-ws9uve
Add sockets, pipes, thread_local and OpenGL
2026-11-25 11:57:16 -08:00
NeoandClaude Opus 5.5 79014e7a5c Add the POSIX functions that programs from Unix call (#24)
* Add C++: exceptions, RTTI and libstdc++ for 68k and PowerPC

- runtime/build-libstdcxx.sh builds LLVM's libunwind and GCC 15.2's
  libstdc++ with clang over the C library, for both CPUs. The patch in
  runtime/libstdcxx/ has the changes for clang and the classic Mac OS.
  runtime/unwind/xcoff-ppc.c has libunwind's two assembly functions for
  PowerPC, which clang cannot assemble for XCOFF.
- codelink.py: COMDAT groups, weak symbols, removal of the sections
  that nothing reaches, and .eh_frame (with the FDEs of the removed
  functions taken out) between __eh_frame_start and __eh_frame_end.
- peflink.py: weak symbols, removal of the csects that nothing reaches,
  TOC entries of class TE, and R_POS/R_NEG pairs.
- macapp.py compiles C++ sources with libstdc++'s headers and links
  libstdc++ and libunwind. All sources are compiled with
  -ffunction-sections and -fdata-sections.
- tests/cxx.cpp checks the runtime and the library; tests/run.sh runs it
  in both simulators when GCC_SRC is set, and CI gets GCC's source.
- docs/cxx.md tells how it works; the README has a summary.

Needs clang-retro/llvm#56 (M68k CFI and libunwind for classic Mac OS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Give every function of the linkers and macapp.py a doc summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Note the C++ test's runs on System 7.6.1 and Mac OS 9.2.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Add file information, folders and POSIX threads to the C library

The Mac layer now gives stat, lstat, fstat, ftruncate, utime, mkdir,
rmdir, opendir, readdir, rewinddir, closedir and getcwd over the HFS
catalog calls, and clock_gettime.

It also gives POSIX threads (pthread.h) over the Thread Manager:
cooperative threads, mutexes, condition variables, keys,
pthread_once, sched_yield, nanosleep and usleep. The library examines
Gestalt('thds') first. ThreadsLib is now a weak import on PowerPC.

The simulators fake the HFS catalog calls, Gestalt, TickCount and the
Thread Manager. tests/libc.c checks the new file functions and
tests/thread.c checks the threads. docs/threads.md tells how the
threads operate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Build the C++ library with the posix thread model

libstdc++ now uses the C library's cooperative threads, so
std::thread, std::mutex, std::condition_variable, std::call_once,
std::async and std::this_thread::sleep_for work.

- build-libstdcxx.sh: thread model posix, gthr-default.h for
  configure, and clock_gettime, nanosleep and sched_yield turned on in
  config.h (configure cannot make the link tests that find them).
- runtime/atomic.c: the __sync_ and __atomic_ functions that clang
  calls when the CPU cannot do an operation (all of them on the
  68000). Plain operations are atomic between cooperative threads.
- pthread_cancel, which gthr-posix.h names: it gives ENOTSUP.
- tests/cxxthread.cpp checks the C++ threads in both simulators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Add the POSIX functions that programs from Unix call

The C library gets dup, dup2, fcntl, pread, pwrite, fsync, access,
chmod, futimens, chdir, realpath, readlink, uname, gethostname, the
user IDs, sysconf for the processor count, flock, poll, ioctl
(FIONREAD), sigaction, malloc_usable_size, the dlopen functions, and
mmap, munmap, msync, mprotect, shm_open and shm_unlink over the heap.
The functions for pipes, processes and terminals fail with the usual
error. MFC's portable layer needs these functions.

build-libc.sh now keeps the C++ headers in lib/include/c++ and copies
the subfolders of runtime/libc/include. The simulators fake
PBFlushFile, the file lock calls and PBHSetVol, give the file number
in GetFCBInfo, and show a locked file in GetCatInfo. tests/libc.c
checks the new functions; docs/posix.md describes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Add chown, fchown, fchmod, getgroups, getsid, pause and fork

MFC's portable layer calls them too. fchmod locks or unlocks the open
file as chmod does; fork fails with ENOSYS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 06:43:55 -08:00
NeoandClaude Opus 5.5 566736dfe3 Build the C++ library with the posix thread model (#23)
* Add C++: exceptions, RTTI and libstdc++ for 68k and PowerPC

- runtime/build-libstdcxx.sh builds LLVM's libunwind and GCC 15.2's
  libstdc++ with clang over the C library, for both CPUs. The patch in
  runtime/libstdcxx/ has the changes for clang and the classic Mac OS.
  runtime/unwind/xcoff-ppc.c has libunwind's two assembly functions for
  PowerPC, which clang cannot assemble for XCOFF.
- codelink.py: COMDAT groups, weak symbols, removal of the sections
  that nothing reaches, and .eh_frame (with the FDEs of the removed
  functions taken out) between __eh_frame_start and __eh_frame_end.
- peflink.py: weak symbols, removal of the csects that nothing reaches,
  TOC entries of class TE, and R_POS/R_NEG pairs.
- macapp.py compiles C++ sources with libstdc++'s headers and links
  libstdc++ and libunwind. All sources are compiled with
  -ffunction-sections and -fdata-sections.
- tests/cxx.cpp checks the runtime and the library; tests/run.sh runs it
  in both simulators when GCC_SRC is set, and CI gets GCC's source.
- docs/cxx.md tells how it works; the README has a summary.

Needs clang-retro/llvm#56 (M68k CFI and libunwind for classic Mac OS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Give every function of the linkers and macapp.py a doc summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Note the C++ test's runs on System 7.6.1 and Mac OS 9.2.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Add file information, folders and POSIX threads to the C library

The Mac layer now gives stat, lstat, fstat, ftruncate, utime, mkdir,
rmdir, opendir, readdir, rewinddir, closedir and getcwd over the HFS
catalog calls, and clock_gettime.

It also gives POSIX threads (pthread.h) over the Thread Manager:
cooperative threads, mutexes, condition variables, keys,
pthread_once, sched_yield, nanosleep and usleep. The library examines
Gestalt('thds') first. ThreadsLib is now a weak import on PowerPC.

The simulators fake the HFS catalog calls, Gestalt, TickCount and the
Thread Manager. tests/libc.c checks the new file functions and
tests/thread.c checks the threads. docs/threads.md tells how the
threads operate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Build the C++ library with the posix thread model

libstdc++ now uses the C library's cooperative threads, so
std::thread, std::mutex, std::condition_variable, std::call_once,
std::async and std::this_thread::sleep_for work.

- build-libstdcxx.sh: thread model posix, gthr-default.h for
  configure, and clock_gettime, nanosleep and sched_yield turned on in
  config.h (configure cannot make the link tests that find them).
- runtime/atomic.c: the __sync_ and __atomic_ functions that clang
  calls when the CPU cannot do an operation (all of them on the
  68000). Plain operations are atomic between cooperative threads.
- pthread_cancel, which gthr-posix.h names: it gives ENOTSUP.
- tests/cxxthread.cpp checks the C++ threads in both simulators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 06:21:42 -08:00
NeoandClaude Opus 5.5 0cb5add04b Add file information, folders and POSIX threads to the C library (#22)
* Add C++: exceptions, RTTI and libstdc++ for 68k and PowerPC

- runtime/build-libstdcxx.sh builds LLVM's libunwind and GCC 15.2's
  libstdc++ with clang over the C library, for both CPUs. The patch in
  runtime/libstdcxx/ has the changes for clang and the classic Mac OS.
  runtime/unwind/xcoff-ppc.c has libunwind's two assembly functions for
  PowerPC, which clang cannot assemble for XCOFF.
- codelink.py: COMDAT groups, weak symbols, removal of the sections
  that nothing reaches, and .eh_frame (with the FDEs of the removed
  functions taken out) between __eh_frame_start and __eh_frame_end.
- peflink.py: weak symbols, removal of the csects that nothing reaches,
  TOC entries of class TE, and R_POS/R_NEG pairs.
- macapp.py compiles C++ sources with libstdc++'s headers and links
  libstdc++ and libunwind. All sources are compiled with
  -ffunction-sections and -fdata-sections.
- tests/cxx.cpp checks the runtime and the library; tests/run.sh runs it
  in both simulators when GCC_SRC is set, and CI gets GCC's source.
- docs/cxx.md tells how it works; the README has a summary.

Needs clang-retro/llvm#56 (M68k CFI and libunwind for classic Mac OS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Give every function of the linkers and macapp.py a doc summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Note the C++ test's runs on System 7.6.1 and Mac OS 9.2.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Add file information, folders and POSIX threads to the C library

The Mac layer now gives stat, lstat, fstat, ftruncate, utime, mkdir,
rmdir, opendir, readdir, rewinddir, closedir and getcwd over the HFS
catalog calls, and clock_gettime.

It also gives POSIX threads (pthread.h) over the Thread Manager:
cooperative threads, mutexes, condition variables, keys,
pthread_once, sched_yield, nanosleep and usleep. The library examines
Gestalt('thds') first. ThreadsLib is now a weak import on PowerPC.

The simulators fake the HFS catalog calls, Gestalt, TickCount and the
Thread Manager. tests/libc.c checks the new file functions and
tests/thread.c checks the threads. docs/threads.md tells how the
threads operate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 06:05:23 -08:00
NeoandClaude Opus 5.5 ce4914c414 Add C++: exceptions, RTTI and libstdc++ for 68k and PowerPC (#21)
* Add C++: exceptions, RTTI and libstdc++ for 68k and PowerPC

- runtime/build-libstdcxx.sh builds LLVM's libunwind and GCC 15.2's
  libstdc++ with clang over the C library, for both CPUs. The patch in
  runtime/libstdcxx/ has the changes for clang and the classic Mac OS.
  runtime/unwind/xcoff-ppc.c has libunwind's two assembly functions for
  PowerPC, which clang cannot assemble for XCOFF.
- codelink.py: COMDAT groups, weak symbols, removal of the sections
  that nothing reaches, and .eh_frame (with the FDEs of the removed
  functions taken out) between __eh_frame_start and __eh_frame_end.
- peflink.py: weak symbols, removal of the csects that nothing reaches,
  TOC entries of class TE, and R_POS/R_NEG pairs.
- macapp.py compiles C++ sources with libstdc++'s headers and links
  libstdc++ and libunwind. All sources are compiled with
  -ffunction-sections and -fdata-sections.
- tests/cxx.cpp checks the runtime and the library; tests/run.sh runs it
  in both simulators when GCC_SRC is set, and CI gets GCC's source.
- docs/cxx.md tells how it works; the README has a summary.

Needs clang-retro/llvm#56 (M68k CFI and libunwind for classic Mac OS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Give every function of the linkers and macapp.py a doc summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

* Note the C++ test's runs on System 7.6.1 and Mac OS 9.2.1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 01:45:16 -08:00
NeoandClaude Opus 5.5 9606ad3fcd Note the console window's run on System 7.6.1 and Mac OS 9.2.1 (#20)
* Temporary: console test app for a run on a real System

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSuLMRWD4gxrktBpac
Signed-off-by: Claude <noreply@anthropic.com>

* Note the console window's run on System 7.6.1 and Mac OS 9.2.1

tests/console.c, built with --console window, ran on QEMU's q800 with
System 7.6.1 and on mac99 with Mac OS 9.2.1 booted from its CD: the
prompt, the typed line, scrolling, end of input and the Finished line
all showed, with no crash. Say so under Not done yet, and note that
Mac OS 9.2.1 from the CD mounts an hformat image only as a CD.

This also removes the test app the last commit added for that run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSuLMRWD4gxrktBpac
Signed-off-by: Claude <noreply@anthropic.com>

---------

Signed-off-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 04:36:16 -08:00
Neo bebeff80f5 Merge pull request #19 from clang-retro/claude/project-thread-pdqy09
Add a console window for the C library
2026-11-11 04:16:26 -08:00
Neo 8bda1272ab Merge pull request #18 from clang-retro/claude/project-thread-pdqy09
PowerPC simulator, static constructors on PowerPC, rename and stdin
2026-11-11 02:36:54 -08:00
Neo c21c9d78ce Merge pull request #17 from clang-retro/claude/project-thread-pdqy09
68k: Sound Driver and Component Manager 3 glue, large code model, time zone
2026-11-10 19:06:14 -08:00
Neo 1f2b88ce28 Merge pull request #16 from clang-retro/claude/project-thread-pdqy09
68k glue: TESetWordBreak and TESetClickLoop
2026-11-08 05:27:32 -08:00
Neo e98b1c66be Merge pull request #15 from clang-retro/claude/project-thread-pdqy09
68k glue: Power Manager extras and SetSoundVol
2026-11-08 03:45:25 -08:00
Neo 84bbb915f1 Merge pull request #14 from clang-retro/claude/project-thread-pdqy09
68k glue: WideShift, WideBitShift, WideSquareRoot, SetUpA5, RestoreA5
2026-11-08 03:28:23 -08:00
Neo 4e0b81770b Merge pull request #13 from clang-retro/claude/project-thread-pdqy09
Add a C library: picolibc over the File and Memory Managers
2026-11-08 03:22:30 -08:00
Neo a25f77b2e6 Merge pull request #12 from clang-retro/claude/project-thread-pdqy09
68k glue for the FixMath conversions and the wide arithmetic
2026-11-08 01:37:27 -08:00
Neo 8c8eac3bd4 Merge pull request #11 from clang-retro/claude/project-thread-pdqy09
Add the runtime library (libmacrt.a) and archive support in the linkers
2026-11-08 01:35:24 -08:00
Neo ebb8bac60b Merge pull request #10 from clang-retro/claude/project-thread-pdqy09
Build applications from this repo: the linkers, macapp.py, and linked examples in CI
2026-11-08 01:32:19 -08:00
Neo 74fe6a110b Merge pull request #9 from clang-retro/claude/project-thread-pdqy09
CI: run the tests and check the generated files
2026-11-08 01:26:08 -08:00
Neo c4365b9fa7 Merge pull request #8 from clang-retro/claude/project-thread-15gw92
Docs: add an API reference and link to clang-retro.github.io
2026-11-07 23:14:38 -08:00
Neo 6c9cc49ae5 Merge pull request #7 from clang-retro/claude/project-thread-15gw92
Add a documentation site, published on GitHub Pages
2026-11-07 23:00:30 -08:00
Neo bfde09cf84 Merge pull request #6 from clang-retro/claude/project-thread-nk081s
Contributors keep their copyright; contribute under AGPL-3.0-only with a DCO
2026-11-07 03:21:04 -08:00
Neo d6f75074c6 Merge pull request #5 from clang-retro/claude/project-thread-nk081s
Relicense under AGPL-3.0-only, with a commercial license available
2026-11-07 03:01:19 -08:00
Neo dcf7894ac1 Merge pull request #4 from clang-dos/claude/project-thread-hnjum9
Expand the SDK from the 1989–92 Developer CDs, and measure which System has each call
2026-11-02 10:58:26 -08:00
Neo 8a85c056fb Merge pull request #3 from clang-dos/claude/project-thread-hnjum9
Add the Mac OS 9 Toolbox: HFS Plus glue, Icon Services, Threads, MP, TEC, URL Access, Keychain
2026-11-02 01:35:30 -08:00
Neo 890cf6c031 Merge pull request #2 from clang-dos/claude/project-thread-hnjum9
Add the Mac OS 8 Toolbox (Appearance, Control/Menu/Dialog/Window Manager 8, Collections, Contextual Menus)
2026-11-01 21:44:21 -08:00
Neo 3fd3f79d91 Merge pull request #1 from clang-dos/claude/project-thread-hnjum9
Classic Mac OS headers for clang, checked against the Mac OS ROM
2026-11-01 19:27:50 -08:00
Neo 67cc6a4658 Initial commit 2026-11-01 16:28:27 -08:00