Repository navigation
SH2/J2: add support - #36
Conversation
Replace the generic TARGET_sh guards with TARGET_sh2 and TARGET_sh2eb so the SH-2 (J2 core) targets get their own handling, and report ARCH as "sh2" for both endiannesses. Also handle R_SH_DIR32 and R_SH_REL32 in the output_relocs() first pass: DIR32 is treated as a good resolved 32-bit reloc, and REL32 is skipped since PC-relative values need no runtime fixup in flat. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
On SH targets, text relocations must be processed regardless of pic/got settings, as is already the case for Blackfin. Default --enable-always-reloc-text to yes for sh* and mention SuperH in the option's help string. Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
gregungerer
left a comment
There was a problem hiding this comment.
I didn't see any specific differences between handling TARGET_sh2 and TARGET_sh2eb in the code. Is there something that needs to be done differently based on endian?
None of the other architecture support for processors that support big and little endian have separate configure targets - like ARM for example. So I guess what I am asking is do we really need to have a separate TARGET_sh2eb?
|
But how do I handle this error then? The tuple is sh2eb-openadk-linux-uclibc. Not sure how to handle this in another way. |
|
On 21/10/26 08:10, Waldemar Brodkorb wrote:
*wbx-github* left a comment (uclinux-dev/elf2flt#36) <#36 (comment)>
But how do I handle this error then?
cc -MM -idirafter /home/wbx/j2-flat/adk/include -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_WCHAR_H=1 -DSTDC_HEADERS=1 -D_ALL_SOURCE=1 -D_COSMO_SOURCE=1 -D_DARWIN_C_SOURCE=1 -D_GNU_SOURCE=1 -D_HPUX_ALT_XOPEN_SOCKET_API=1 -D_NETBSD_SOURCE=1 -D_OPENBSD_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D__STDC_WANT_IEC_60559_ATTRIBS_EXT__=1 -D__STDC_WANT_IEC_60559_BFP_EXT__=1 -D__STDC_WANT_IEC_60559_DFP_EXT__=1 -D__STDC_WANT_IEC_60559_EXT__=1 -D__STDC_WANT_IEC_60559_FUNCS_EXT__=1 -D__STDC_WANT_IEC_60559_TYPES_EXT__=1 -D__STDC_WANT_LIB_EXT2__=1 -D__STDC_WANT_MATH_SPEC_FUNCS__=1 -D_TANDEM_SOURCE=1 -D__EXTENSIONS__=1 -DHAVE_LIBZ=1 -DHAVE_LIBZSTD=1 -DHAVE_FCNTL_H=1 -DHAVE_UNISTD_H=1 -DHAVE_VPRINTF=1 -DHAVE_DCGETTEXT=1 -DHAVE_GETLINE=1 -
DHAVE_STRSIGNAL=1 -DTARGET_sh2eb -DTARGET_CPU="sh2eb" -DSYMBOL_PREFIX="" -DBINUTILS_LDSCRIPTDIR="/../sh2eb-openadk-linux-uclibc/lib" -DTARGET_ALIAS="sh2eb-openadk-linux-uclibc" -DNO_GOT_CHECK=1 -DUSE_EMIT_RELOCS=1 -DEMIT_CTOR_DTOR=0 -DALWAYS_RELOC_TEXT=0 -DHAVE_BFD_XTENSA_PDIFF_RELOCS=0 -I. -Ibfd-headers ./*.c > .deps
./elf2flt.c:138:2: error: #error "Don't know how to support your CPU architecture??"
138 | #error "Don't know how to support your CPU architecture??"
| ^~~~~
The tuple is sh2eb-openadk-linux-uclibc. Not sure how to handle this in another way.
Yeah, that is interesting. It is not clear to me how ARM (and other EB supporting
architectures) do this. I can only guess that they simply use something like
--target=arm for example. So not the fully qualified tuple.
The changes seem reasonable when using the full tuple.
Regards
Greg
|
|
BTW, if someone want to test this change in Qemu, following fork has support for J2 machine via qemu-system-sh4eb: |
|
Hi Wakdenar,
On 26/10/26 23:26, Waldemar Brodkorb wrote:
*wbx-github* left a comment (uclinux-dev/elf2flt#36) <#36 (comment)>
BTW, if someone want to test this change in Qemu, following fork has support for J2 machine via qemu-system-sh4eb:
https://github.com/lordrasmus/qemu/tree/uclibc-ng <https://github.com/lordrasmus/qemu/tree/uclibc-ng>
@gregungerer <https://github.com/gregungerer>: anything else I need to do before you merge my changes?
No, I think it is all good.
I merged it.
Regards
Greg
|
Hi,
these two patches get a uClibc-ng based system with Linux Kernel 6.18.x boot up on a Numato MimasV2 FPGA with J2 core.
There is a small kernel patch required, which was sent to the Linux SH kernel mailing list. Another fixup is in uClibc-ng required which is already upstream.
thanks in advance,
Waldemar