Ticket #8 (closed defect: fixed)

Opened 7 years ago

Last modified 6 years ago

ARM4_API_CALL in arm4os.h not consistently defined for Linux/i386

Reported by: stefan.ruppert@… Owned by: stefan.ruppert@…
Priority: major Milestone: ARM4SDK Release 1.3
Component: ARM 4.0 C Binding Version: 1.1
Keywords: Cc:

Description (last modified by stefan.ruppert@…) (diff)

The arm4os.h header file defines the ARM4_API_CALL macro as __attribute__((stdcall)) if the following macros are defined

  • linux
  • __GNUC__
  • __i386__

But the linux define is not always set by gcc. If you specify -std=c99 for example, the linux define is not provided by gcc since it is not posix compatible.

Therefore the calling convention is not always guaranteed to be the same between the libarm4.so and the calling application, which can lead in major issues including memory leaks on the stack.

For example if the libarm4.so is compiled with the -std=c99 option it uses the default calling convention of the compiler instead of the defined stdcall calling convention. An instrumented application which does not use the -std=c99 option will use the stdcall calling convention and will not cleanup the parameters pushed on the stack for calls into the libarm4.so.

Change History

comment:1 Changed 7 years ago by stefan.ruppert@…

  • Description modified (diff)

comment:2 Changed 6 years ago by stefan.ruppert@…

  • Status changed from new to accepted

comment:3 Changed 6 years ago by stefan.ruppert@…

  • Status changed from accepted to closed
  • Resolution set to fixed

Fixed with r13.

Note: See TracTickets for help on using tickets.