Building the Bootloader
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I think that I may have been able to successfully cross compile ipl to an elf binary with text starting at offset 0. Note that this requires that
Quoted 8 lines
Quoted 2 lines
offset 0 sounds bad as we may not corrupt page 0 (the PDC puts some data we need there).
This is easily changed but seems consistent with the "-R 0" option to the hp linker used in Jason Eckhardt's
Makefile. It would appear that mkipl builds the actual image. On the otherhand, no care was taken to compile using pic so there may be a relocation problem.
Care was taken -- the ipl is position independent with the chosen combination of flags and code design. The ipl makes no assumption about the location it will be loaded into by the ROM (see ipl_s.s). Text offset zero is correct for linking in the scheme I have chosen. The bootloader determines where is was loaded at runtime and sets the dp and sp accordingly. All of this should be obvious from the code.
The specific combination of flags allowed me to get something resembling a straight binary image (by ignoring the header) and position independence. For some reason I can't remember now, -fpic didn't get the job done (perhaps a compiler defect).
In any case, I expect later that we will just link the ipl as a standard ELF and then extract the "actual" binary image from it (as chris mentioned earlier, and as mentioned in the HILO README). The point was to get a simple bootloader going, which I did (there were no cross tools at that time, I therefore just used gcc on HPUX). Any number of tweaks can easily be made as needed.
jason.
Quoted 6 lines
Care was taken -- the ipl is position independent with the chosen combination of flags and code design. The ipl makes no assumption about the location it will be loaded into by the ROM (see ipl_s.s). Text offset zero is correct for linking in the scheme I have chosen. The bootloader determines where is was loaded at runtime and sets the dp and sp accordingly. All of this should be obvious from the code.
It is not obvious to me that the C code is position independent.
Quoted 4 lines
The specific combination of flags allowed me to get something resembling a straight binary image (by ignoring the header) and position independence. For some reason I can't remember now, -fpic didn't get the job done (perhaps a compiler defect).
When -fpic is used, $global$ is not used as an offset to access data variables. Gnu ld doesn't seem to like $global$ not being used:
624 (hiauly1)dave> make
hppa-linux-as ipl_s.s -o ipl_s.o
ipl_s.s: Assembler messages:
ipl_s.s:65: Warning: Ignoring subspace decl due to ELF BFD bugs. ipl_s.s:68: Warning: Ignoring subspace decl due to ELF BFD bugs. ipl_s.s:83: Warning: Ignoring subspace decl due to ELF BFD bugs. ipl_s.s:243: Warning: Ignoring subspace decl due to ELF BFD bugs.
hppa-linux-gcc -fwritable-strings -mdisable-fpregs -fpic -c ipl_c.c
hppa-linux-gcc -fwritable-strings -mdisable-fpregs -fpic -c rom_interface.c
hppa-linux-ld -Ttext 0 -N ipl_s.o ipl_c.o rom_interface.o -L/eh
ic/a/lib/gcc-lib/hppa-linux/egcs-2.91.60 -lgcc -o ipl ipl_c.o: In function `IPL_main':ipl_c.o($CODE$+0x60): undefined reference to `$global$'
make: *** [ipl] Error 1
Inspection of ipl_c.o shows that there is no actual reference to $global$ in ipl_c.o. No errors occur if -fpic is removed.
Signature · 2 lines
J. David Anglin [email protected] National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
Quoted 10 lines
It is not obvious to me that the C code is position independent.
Quoted 4 lines
The specific combination of flags allowed me to get something resembling a straight binary image (by ignoring the header) and position independence. For some reason I can't remember now, -fpic didn't get the job done (perhaps a compiler defect).
When -fpic is used, $global$ is not used as an offset to access data variables. Gnu ld doesn't seem to like $global$ not being used:
Quoted 15 lines
624 (hiauly1)dave> make
hppa-linux-as ipl_s.s -o ipl_s.o
ipl_s.s: Assembler messages:
ipl_s.s:65: Warning: Ignoring subspace decl due to ELF BFD bugs. ipl_s.s:68: Warning: Ignoring subspace decl due to ELF BFD bugs. ipl_s.s:83: Warning: Ignoring subspace decl due to ELF BFD bugs. ipl_s.s:243: Warning: Ignoring subspace decl due to ELF BFD bugs.
hppa-linux-gcc -fwritable-strings -mdisable-fpregs -fpic -cipl_c.c
hppa-linux-gcc -fwritable-strings -mdisable-fpregs -fpic -crom_interface.c
hppa-linux-ld -Ttext 0 -N ipl_s.o ipl_c.o rom_interface.o -L/eh
ic/a/lib/gcc-lib/hppa-linux/egcs-2.91.60 -lgcc -o ipl ipl_c.o: In function `IPL_main':ipl_c.o($CODE$+0x60): undefined reference to `$global$'
make: *** [ipl] Error 1
Here are Jeff Law's comments on using elf32-hppa with PIC: