Symbian: unalighned relocations for pointers-to-members

Фёдар Стрыжнёў (Fiodar Stryzhniou) fedor_qd@mail.ru
Sun Jan 16 11:52:41 GMT 2022


On Tue, 4 Jan 2022 13:01:14 +0000
Richard Earnshaw <Richard.Earnshaw@foss.arm.com> wrote:

> I've had a very quick look at this (I can only look at the compiler 
> output as I do not have any of the other symbian-related tools).  The 
> only thing I can think of is that the problem is coming from the dwarf 
> debug information.  Can you check whether the problem still occurs if 
> you add -g0 to the end of the list of compilation options (or remove all 
> the -g... options from the compilation command).
> 
> R.

Sorry for long response. You mail was moved to spam by mail provider.

Error remains.

I made this file OS-independent. It can be linked and compiled by GCC.
I compile and use object dump. Found unaligned entry. Is it error?

Output:
arm-none-symbianelf-gcc -c -marm main.cpp
arm-none-symbianelf-readelf -a main.o
Relocation section '.rel.rodata' at offset 0x9e0 contains 8 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000058  00000f02 R_ARM_ABS32       00000000   .rodata
00000060  00000f02 R_ARM_ABS32       00000000   .rodata
00000064  00001a02 R_ARM_ABS32       00000000   _ZN5Items17isRune[...]
0000006c  00001b02 R_ARM_ABS32       00000000   _ZN5Items18putRun[...]
00000081  00000f02 R_ARM_ABS32       00000000   .rodata
      ^^
00000089  00000f02 R_ARM_ABS32       00000000   .rodata
0000008d  00001a02 R_ARM_ABS32       00000000   _ZN5Items17isRune[...]
00000095  00001b02 R_ARM_ABS32       00000000   _ZN5Items18putRun[...]
> 
> On 29/12/2021 11:04, Фёдар Стрыжнёў (Fiodar Stryzhniou) via Gcc-help wrote:
> > On Mon, 20 Dec 2021 15:37:26 +0000
> > Richard Earnshaw <Richard.Earnshaw@foss.arm.com> wrote:
> > 
> >> On 16/12/2021 00:39, Фёдар Стрыжнёў (Fiodar Stryzhniou) via Gcc-help wrote:
> >>> Hello. I maintain ScummVM port for Symbian Series 60v3. ScummVM is a complete rewrite of hundreds old games' executables and is not an emulator. It's free and opensource.
> >>>
> >>> Last year, when I prepared a version 2.2.0 in the release, it was faced with the fact that when the Ultima engine is turned on in the executable file (supports Ultima 1, 4, 6, 8), it does not start. Ultima 4 & 6 support disabling allowed SCUMMVM. In the spring of this year, after some changes in the source code Ultima, the elf2e32 utility has begun to complete the work with the error "Line 427". To clarify the causes of the error, a rebeling of the code responsible for the support of Ultima 4 & 6 was carried out.
> >>> The rebel passed as follows:
> >>> 1. Removed ultima.lib (Static Library)
> >>> 2. Left the entry point, deleted all other files associated with Ultima 4/6 from the project assembly
> >>> 3. Collected ultima.lib, then collected scummvm.exe
> >>> 4. Added files to the project and continued to collect until the error did not jump out.
> >>>
> >>> I have done these steps first for Ultima 4, then - 6. In both cases, the reason was pointer-to-member array declaration.
> >>> Ultima 4 - https://github.com/scummvm/scummvm/blob/master/engines/ultima/ultima4/game/item.cpp#L49
> >>> Ultima 6 - https://github.com/scummvm/scummvm/blob/master/engines/ultima/nuvie/usecode/u6_object_types.h#L28
> >>>
> >>> elf2e32 creates E32 aka EPOC32 aka Symbian exe and dlls from elf.
> >>>
> >>> Analysis of the elf2e32 source code indicated the reason - when checking the created file, unaligned relocations were found. After modifying the source code, the elf2e32 was printed unaligned relocations. I redirect to file "readelf -a <name of elf>". I find several random Elf32_Rel r_offset from elf2e32 in readelf output. GCC 5.4.0 and 11.2.0 give same result.
> >>>
> >>>
> >>
> >> I can't tell from this what the issue might be.  To stand any chance of
> >> proceeding further, I think we're going to need a simple,
> >> self-contained, testcase that can demonstrate the problem.
> >>
> >> I don't think I've seen a question about SymbianOS support in over 5
> >> years, now, possibly longer.  Given that SymbianOS itself was
> >> discontinued back around 2013 (8 years ago now), the GCC port has
> >> declined to the point where I suspect it's likely to get deprecated
> >> soon, due to lack of maintenance.
> >>
> >> R.
> > 
> > I made very small testcase in main.cpp. Attachment contains Carbide С++
> > project files too if needed.
> > 
> > Console output taken from Carbide C++:
> > Using built-in specs.
> > COLLECT_GCC=arm-none-symbianelf-gcc
> > Target: arm-none-symbianelf
> > Configured with: ../gcc-11.2.0/./configure --target=arm-none-symbianelf
> > --prefix=/usr/local/gcc-11.2.0 --without-headers --enable-languages=c,c+
> > +,lto --enable-poison-system-directories --enable-lto --with-newlib
> > --enable-long-long --with-libiconv-prefix=/usr/local --with-dwarf2
> > --enable-interwork --enable-tls --enable-multilib
> > --disable-hosted-libstdcxx --disable-libstdcxx-pch
> > --disable-option-checking --disable-threads --disable-nls
> > --disable-win32-registry --disable-libssp --disable-shared
> > --enable-wchar_t --enable-extra-sgxxlite-multilibs --enable-c99
> > --with-static-standard-libraries Thread model: single Supported LTO
> > compression algorithms: zlib gcc version 11.2.0 (GCC)
> > COLLECT_GCC_OPTIONS='-g3' '-gdwarf-2' '-fexceptions' '-Wall'
> > '-Wno-unknown-pragmas'  '-mapcs-frame' '-mthumb-interwork' '-pipe'
> > '-nostdinc' '-c' '-Wno-multichar' '-Wno-unused' '-Wformat=0' '-v'
> > '-marm' '-mfloat-abi=soft' '-D' '__MARM_INTERWORK__' '-MD' '-D'
> > '_DEBUG' '-D' '_UNICODE' '-D' '__GCCE__' '-D' '__SYMBIAN32__' '-D'
> > '__S60_50__' '-D' '__S60_3X__' '-D' '__SERIES60_3X__' '-D' '__GCCE__'
> > '-D' '__EPOC32__' '-D' '__MARM__' '-D' '__EABI__' '-D' '__MARM_ARMV5__'
> > '-D' '__EXE__' '-D' '__SUPPORT_CPP_EXCEPTIONS__' '-D' '__MARM_ARMV5__'
> > '-D'
> > '__PRODUCT_INCLUDE__="/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant/Symbian_OS.hrh"'
> > '-Wno-ctor-dtor-privacy' '-fpermissive' '-std=c++14' '-include'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/INCLUDE/GCCE/gcce.h' '-I'
> > '/Symbian/Projects/unalighned_reloc_report/src' '-I'
> > '/Symbian/Projects/unalighned_reloc_report/inc' '-I'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include' '-I'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant' '-I'
> > 'd:/mingw/msys/1.0/local/gcc-11.2.0/lib/gcc/arm-none-symbianelf/11.2.0/include'
> > '-o'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/main.o'
> > '-mlibarch=armv5t' '-march=armv5t' '-dumpdir'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/'
> > d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../libexec/gcc/arm-none-symbianelf/11.2.0/cc1plus.exe
> > -quiet -nostdinc -v -I /Symbian/Projects/unalighned_reloc_report/src
> > -I /Symbian/Projects/unalighned_reloc_report/inc
> > -I /Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include
> > -I /Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant -I
> > d:/mingw/msys/1.0/local/gcc-11.2.0/lib/gcc/arm-none-symbianelf/11.2.0/include
> > -iprefix d:\mingw\msys\1.0\local\gcc-11.2.0\bin
> > \../lib/gcc/arm-none-symbianelf/11.2.0/
> > -MD /Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/main.d
> > -MQ /Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/main.o
> > -dD -D__USES_INITFINI__ -D __MARM_INTERWORK__ -D _DEBUG -D _UNICODE -D
> > __GCCE__ -D __SYMBIAN32__ -D __S60_50__ -D __S60_3X__ -D
> > __SERIES60_3X__ -D __GCCE__ -D __EPOC32__ -D __MARM__ -D __EABI__ -D
> > __MARM_ARMV5__ -D __EXE__ -D __SUPPORT_CPP_EXCEPTIONS__ -D
> > __MARM_ARMV5__ -D
> > __PRODUCT_INCLUDE__="/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant/Symbian_OS.hrh"
> > -include /Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/INCLUDE/GCCE/gcce.h /Symbian/Projects/unalighned_reloc_report/src/main.cpp
> > -fno-builtin -fvisibility=hidden -fno-short-enums -fshort-wchar -quiet
> > -dumpdir /Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/
> > -dumpbase main.cpp -dumpbase-ext .cpp -mapcs-frame -mthumb-interwork
> > -marm -mfloat-abi=soft -mlibarch=armv5t -march=armv5t -g3 -gdwarf-2
> > -Wall -Wno-unknown-pragmas -Wno-multichar -Wno-unused -Wformat=0
> > -Wno-ctor-dtor-privacy -std=c++14 -version -fexceptions -fpermissive
> > -fno-builtin -fvisibility=hidden -fno-short-enums -fshort-wchar -o - |
> > d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../lib/gcc/arm-none-symbianelf/11.2.0/../../../../arm-none-symbianelf/bin/as.exe
> > -march=armv5t -mapcs-frame -mfpu=vfp -mthumb-interwork -mfloat-abi=soft
> > -meabi=5
> > -o /Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/main.o
> > GNU C++14 (GCC) version 11.2.0 (arm-none-symbianelf) compiled by GNU C
> > version 6.3.0, GMP version 6.1.0, MPFR version 4.1.0, MPC version
> > 1.2.1, isl version isl-0.16.1-GMP
> > 
> > GGC heuristics: --param ggc-min-expand=100 --param
> > ggc-min-heapsize=131072
> > #include "..." search starts here:
> > #include <...> search starts here:
> >   /Symbian/Projects/unalighned_reloc_report/src
> >   /Symbian/Projects/unalighned_reloc_report/inc
> >   /Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include
> >   /Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant
> >   d:/mingw/msys/1.0/local/gcc-11.2.0/lib/gcc/arm-none-symbianelf/11.2.0/include
> > End of search list.
> > GNU C++14 (GCC) version 11.2.0 (arm-none-symbianelf)
> > 	compiled by GNU C version 6.3.0, GMP version 6.1.0, MPFR
> > version 4.1.0, MPC version 1.2.1, isl version isl-0.16.1-GMP
> > 
> > GGC heuristics: --param ggc-min-expand=100 --param
> > ggc-min-heapsize=131072 Compiler executable checksum:
> > 7bd26c26f5e3795062462f9efc696d4f
> > COMPILER_PATH=d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../libexec/gcc/arm-none-symbianelf/11.2.0/;d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../libexec/gcc/;d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../lib/gcc/arm-none-symbianelf/11.2.0/../../../../arm-none-symbianelf/bin/
> > LIBRARY_PATH=d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../lib/gcc/arm-none-symbianelf/11.2.0/;d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../lib/gcc/;d:/mingw/msys/1.0/local/gcc-11.2.0/bin/../lib/gcc/arm-none-symbianelf/11.2.0/../../../../arm-none-symbianelf/lib/
> > COLLECT_GCC_OPTIONS='-g3' '-gdwarf-2' '-fexceptions' '-Wall'
> > '-Wno-unknown-pragmas'  '-mapcs-frame' '-mthumb-interwork' '-pipe'
> > '-nostdinc' '-c' '-Wno-multichar' '-Wno-unused' '-Wformat=0' '-v'
> > '-marm' '-mfloat-abi=soft' '-D' '__MARM_INTERWORK__' '-MD' '-D'
> > '_DEBUG' '-D' '_UNICODE' '-D' '__GCCE__' '-D' '__SYMBIAN32__' '-D'
> > '__S60_50__' '-D' '__S60_3X__' '-D' '__SERIES60_3X__' '-D' '__GCCE__'
> > '-D' '__EPOC32__' '-D' '__MARM__' '-D' '__EABI__' '-D' '__MARM_ARMV5__'
> > '-D' '__EXE__' '-D' '__SUPPORT_CPP_EXCEPTIONS__' '-D' '__MARM_ARMV5__'
> > '-D'
> > '__PRODUCT_INCLUDE__="/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant/Symbian_OS.hrh"'
> > '-Wno-ctor-dtor-privacy' '-fpermissive' '-std=c++14' '-include'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/INCLUDE/GCCE/gcce.h' '-I'
> > '/Symbian/Projects/unalighned_reloc_report/src' '-I'
> > '/Symbian/Projects/unalighned_reloc_report/inc' '-I'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include' '-I'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/variant' '-I'
> > 'd:/mingw/msys/1.0/local/gcc-11.2.0/lib/gcc/arm-none-symbianelf/11.2.0/include'
> > '-o'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/main.o'
> > '-mlibarch=armv5t' '-march=armv5t' '-dumpdir'
> > '/Symbian/S60_5th_Edition_SDK_v1.0/EPOC32/BUILD/Symbian/Projects/unalighned_reloc_report/epoc/UNALIGHNED_RELOC_REPORT/GCCE/udeb/main.'
> > ‘files copied:         1. line 437 elf2e32 : Error: E1066: Image failed
> > validation make[1]: *** [\Symbian\S60_5th_Edition_SDK_v1.0\epoc32
> > \release\gcce\udeb\unalighned_reloc_report.exe] Error 1 make: ***
> > [TARGETUNALIGHNED_RELOC_REPORT] Error 2
> > 
> > -----
> > Фёдар Стрыжнёў(Fiodar Stryzhniou) <fedor_qd@mail.ru>
> > 


----- 
Фёдар Стрыжнёў(Fiodar Stryzhniou) <fedor_qd@mail.ru>


More information about the Gcc-help mailing list