-
Notifications
You must be signed in to change notification settings - Fork 281
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
pdp11 toolchain blues #577
Comments
That looks a first glance like a linker bug. The DISP16 one especially looks odd because a 16bit displacement on a 16bit machne cannot, as far as I can see, actually overflow - it can hit any address. If you objdump syscall_other.o can you see what the actual failing items are ? |
Checking into the objects that it fails on (fails on different things depending on the order of input objects on the command line). 0x2c8 in syscall_other.o doesn't actually reference any address but all the errors are for stack manipulation instructions.
over in syscall_fs3.o
|
A switch from GCC 7.2.0 down to GCC 4.9.4 while keeping the latest binutils seems to have fixed this. pdp11-aout-objcopy fuzix.aout -O binary ../fuzix.bin |
https://sourceware.org/bugzilla/show_bug.cgi?id=22859 For at least one bug I've found now I am trying to get gcc/gas for pdp-11 behaving and build stuff. I'm still looking at the other bits having also broken gcc twice so far 8) |
GCC bugs for completeness Although neither break later PDP11 just early ones |
I'm a rank amateur who has been poking around the PDP-11 stuff mostly in GNU as. Looking around in gcc PDP-11 bug reports, I found those regarding the -m10 option. Using the git version of gcc (9.0.0 20180808), the errors with regards to the -m10 option seem to no longer be the case. I posted my results with the relevant bug reports. The "relocation truncated to fit" one still occurs with the test case with the bug report. Since gcc 4.9.4 apparently works, I'll poke around naively and try to find what changed in the upcoming days. |
Thanks - much appreciated. |
I've been toying with linking C to some rl ard rx bootloaders, with @CaptNapalm 's suggestion. The 7.3.0 GCC with most recent binutils appears to build correct code. So far successful. I can "make kernel" successfully. Apps require additional makefiles still. |
The PDP-11 binutils have been patched recently. It's worth a try again. |
thanks for the heads up |
Still seems to be broken. The moment a reference crosses 15bits in size I get an error So for example in start.c
blows up, despite &ptab[maxproc] being within 16bits but shrinking maxproc a bit "fixes" that one when it goes under 0x8000. I guess nobody uses the PDP11 toolchain to build binaries over 32K Interestingly with the current toolchain if I put the data first then the negative displacements and the like stop it blowing up which may mean we have a workaround. |
Ok this fixes the main cause. I think |
I'm the original author of the pdp11 target in binutils, so I'd like to follow this discussion. |
@larsbrinkhoff At the moment I am seeing "16" relocations fail if they go above 32K, which I think is just the howto table but I'm not a binutils person so I am poking in the dark. Ditto in a few cases with "DISP16", which I really don't understand since PDP-11 is 16bit and wraps so I don't understand what it is trying to check, or what I should dump out to see what is going on ? |
I'm not a binutils person either, but I'd say your patch to howto_table_pdp11 looks right or at least in the right direction. |
I've been working on the pdp11 port of binutils recently to add a --imagic option to output code for separate instruction and data spaces. At the suggestion of Paul Koning, maintainer of the gcc pdp11 port, I have also implemented a pdp11-elf32 target with the goal of compiling C++ for the PDP11 (that's at pre-alpha status and I'm working on the newlib port so I can try g++). The biggest piece of that addition was to hook into the ELF relocation, so I'll see if a similar problem happens there. I definitely don't qualify as a binutils expert at this point, but I have been reading a lot of code. I accepted an invitation to become the maintainer of the pdp11 port. |
@slcasner cool - and if ELF relocation works I can just switch to elf and use the binutils elf -> raw binary conversion which is how 68K kernels get done today |
With binutils 2.41 and GCC 13.2.0 it seems to build a valid kernel, with .data moved back to its normal spot after .text. Produces a ~37 kB binary file. Loaded into simh, a call to outchar early on works. Sure to be more bugs.
|
Until the disk boot loaders are working, it may be helpful to load the kernel binary directly into RAM. SIMH expects a PDP-11 load tape file for its "load" command. This bin2load utility https://github.com/jguillaumes/retroutils/tree/master/bin2load is able to convert a binary file to that format.
|
Yay I will try and build a tool chain again when I get a bit of time. Thanks for the tap pointer |
GCC 13.2.0 seems to be generating incorrect code with -Os optimization at least
into
if optimization is turned off it still fits at 47 kB text, and I can trace things working through ptab_alloc() |
I've been working on a RL01 disk bootloader for FUZIX, and having a kernel binary (even if broken) to load is the next step.
Fuzix kernel compiles with pdp11 GCC + binutils but all attempts to link have failed so far.
Using this fuzix.ld to assume a kernel at 0x1000:
I get an esoteric error:
Something about address sizes in linking?
Is the kernel too large for the PDP-11, or am I misusing the toolchain / linking parameters? LD is not my strong suite.
The text was updated successfully, but these errors were encountered: