Hi all,

I am commiting this patch that cleans up gcc's support of Windows CE for 
arm.

This patch fixes some major bugs/annoyances we had:

 - __declspec(dllexport/dllimport) was so broken that it was hurting.
We weren't passing -export= in .drectve properly,
so the linker would default to exporting everything. If you used .def 
files, this would go unnoticed.

 - We had some major violations of WinCE's ABI:

Currently this test gives wrong results:
struct abi_check_doubles { char a; double d; };
struct foo0 { char x; };
struct foo1 { char x;char :0; char y; };
struct foo2 { char x; int :0; int :0; int :0; int :0; char y; };
struct foo3 { char x; char :1; char y; };
struct foo4 { char x; int :1; char y; };

int main()
{
    printf ("Size of foo0 is %d, should be 1\n", sizeof (struct foo0));
    printf ("Size of foo1 is %d, should be 2\n", sizeof (struct foo1));
    printf ("Size of foo2 is %d, should be 2\n", sizeof (struct foo2));
    printf ("Size of foo3 is %d, should be 3\n", sizeof (struct foo3));
    printf ("Size of foo4 is %d, should be 12\n", sizeof (struct foo4));
    return 0;
}

The right results where taken from compiling the test case with MSVC.
Note that this is a simplified test case.
If you where experiencing weird crashes before while calling/interfacing 
MSVC/eVC compiled code,
including the system dlls, this may very well be the reason.

This patch also brings gcc support very close to what should be 
submitted upstream.

I'm only posting the ChangeLog, since the patch is pretty big. You can 
see it at cegcc-svn
or by svn updating.
I only tested this on mingw32ce yet, will test cegcc tomorrow.

Cheers,
Pedro Alves

---

src/gcc/gcc/ChangeLog.ce

2006-10-30  Pedro Alves  <[EMAIL PROTECTED]>

    * target-def.h (TARGET_ATTRIBUTE_TABLE): Only define if not
    defined before.
    * config/arm/arm.c (arm_file_end): Give it external linkage.
    (arm_handle_struct_attribute): New.
    (arm_ms_bitfield_layout_p): New.
    (TARGET_ATTRIBUTE_TABLE, TARGET_ASM_FILE_END,
    TARGET_ENCODE_SECTION_INFO, TARGET_STRIP_NAME_ENCODING): Move
    declarations to config/arm/arm.h.
    (TARGET_MS_BITFIELD_LAYOUT_P): Define to
    arm_ms_bitfield_layout_p.
    (arm_return_in_memory): Replace #ifdef'ing on ARM_WINCE with
    TARGET_RETURN_AGGREGATES_IN_MEMORY.
    (arm_attribute_table): Add shared, ms_struct, gcc_struct
    attributes.
    Allow subtarget to add attributes using
    SUBTARGET_ATTRIBUTE_TABLE.
    (arm_elf_asm_constructor): Only compile on OBJECT_FORMAT_ELF.
    (thumb_output_function_prologue): Call arm_pe_strip_name_encoding
    instead of arm_strip_name_encoding.
    (arm_handle_struct_attribute): New function.
    (arm_ms_bitfield_layout_p): New function.
    * config/arm/arm.h (TARGET_ASM_FILE_END, TARGET_ATTRIBUTE_TABLE,
    TARGET_ENCODE_SECTION_INFO, TARGET_STRIP_NAME_ENCODING): Define.
    * config/arm/t-wince-cegcc: Add cegcc1.o rule.
    (TARGET_LIBGCC2_CFLAGS): Add -mwin32.
    * config/arm/t-mingw32 (SYSTEM_INCLUDE_DIR): Delete.
    (NATIVE_SYSTEM_HEADER_DIR): Likewise.
    * config/arm/arm-protos.h (arm_file_end,
    arm_pe_asm_named_section, arm_pe_section_type_flags,
    arm_pe_strip_name_encoding, arm_pe_output_labelref,
    arm_pe_handle_shared_attribute): Declare.
    * config/arm/wince-pe.h:
    (TARGET_VERSION): Set to "(arm Windows CE/Native SDK)".
    (MULTILIB_DEFAULTS): Remove -mfpu=vfp.
    (SUBTARGET_CPU_DEFAULT): Default to TARGET_CPU_arm8 (armv4).
    (CPP_SPEC): Remove cegcc specifics.
    (ASM_SPEC): Don't pass -cpu=iwmmxt to assembler when -mcpu=xscale
    is used.
    (SUBTARGET_EXTRA_SPECS, SUBTARGET_ASM_FLOAT_SPEC): Remove.
    (TARGET_OS_CPP_BUILTINS): Add _stdcall, _fastcall and _cdecl.
    (SUBTARGET_CPP_SPEC, HANDLE_SYSV_PRAGMA,
    HANDLE_PRAGMA_PACK_PUSH_POP): Delete.
    (STARTFILE_SPEC): Remove cegcc specifics.
    (LIBGCC_SPEC): Likewise.
    (LIB_SPEC): Likewise.
    (COMMON_ASM_OP, ASM_OUTPUT_COMMON, ASM_DECLARE_OBJECT_NAME,
    ASM_DECLARE_FUNCTION_NAME, ASM_OUTPUT_EXTERNAL,
    ASM_OUTPUT_EXTERNAL_LIBCALL, ASM_OUTPUT_ALIGNED_BSS,
    TARGET_ASM_FILE_END, SUPPORTS_ONE_ONLY, MULTIPLE_SYMBOL_SPACES):
    Delete.
    (ARM_MCOUNT_NAME): Define to _mcount to avoid conflicts.
    (CHECK_STACK_LIMIT): Delete.
    (TARGET_DEFAULT): Match Windows CE ABI with
    MASK_MS_BITFIELD_LAYOUT and MASK_RETURN_AGGREGATES_IN_MEMORY.
    (TARGET_SUBTARGET_DEFAULT): Delete.
    (BIGGEST_FIELD_ALIGNMENT): Delete.
    (SET_ASM_OP): Delete.
    (DEFAULT_STRUCTURE_SIZE_BOUNDARY): Define to 8 as WinCE's ABI
    requires.
    (ASM_OUTPUT_DEF_FROM_DECLS, TARGET_USE_JCR_SECTION,
    TARGET_USE_LOCAL_THUNK_ALIAS_P, SUBTARGET_ATTRIBUTE_TABLE):
    Delete.
    * config/arm/mingw32.h (STANDARD_INCLUDE_DIR,
    STANDARD_INCLUDE_COMPONENT): Delete.
    * config/arm/arm.opt: New option -mreturn-aggregates-in-memory.
    * config/arm/pe.opt: New option -mms-bitfields.
    * config/arm/pe.c (arm_pe_handle_shared_attribute): New.
    (arm_pe_strip_name_encoding): New.
    (arm_pe_output_labelref): Call arm_pe_strip_name_encoding instead
    of arm_strip_name_encoding.
    (arm_pe_unique_section): Likewise.
    (arm_pe_section_type_flags): New.
    (arm_pe_asm_named_section ): New.
    (arm_pe_file_end): Call arm_file_end.
    * config/arm/pe.h (HANDLE_SYSV_PRAGMA): New.
    (HANDLE_PRAGMA_PACK_PUSH_POP): New.
    (SUBTARGET_OVERRIDE_OPTIONS): New.
    (TARGET_ASM_NAMED_SECTION): Set to arm_pe_asm_named_section
    specialized version.
    (TARGET_SECTION_TYPE_FLAGS): New.
    (ASM_DECLARE_FUNCTION_NAME): Don't output -export to .drectve
    directly.
    Use arm_pe_record_exported_symbol instead.
    (TARGET_ASM_FILE_END): Set to arm_pe_file_end.
    (TARGET_ENCODE_SECTION_INFO): Set to arm_pe_encode_section_info.
    (TARGET_STRIP_NAME_ENCODING): Set to arm_pe_strip_name_encoding.
    (COMMON_ASM_OP): New.
    (ASM_OUTPUT_COMMON): Don't output -export to .drectve directly.
    Use arm_pe_record_exported_symbol instead.
    (ASM_DECLARE_OBJECT_NAME): Likewise.
    (ASM_OUTPUT_EXTERNAL): New.
    (ASM_OUTPUT_EXTERNAL_LIBCALL): New.
    (PROFILE_HOOK): New.
    (ASM_OUTPUT_DEF_FROM_DECLS): New.
    (SUPPORTS_ONE_ONLY).
    (SUBTARGET_ATTRIBUTE_TABLE): New.
    (TARGET_USE_LOCAL_THUNK_ALIAS_P): New.
    (TARGET_USE_JCR_SECTION): New.
    (SUBTARGET_ENCODE_SECTION_INFO): New.
    (TARGET_STRIP_NAME_ENCODING): New.
    * config/arm/wince-cegcc.h (SUBTARGET_EXTRA_SPECS,
    EXTRA_OS_CPP_BUILTINS, TARGET_OS_CPP_BUILTINS,
    SUBTARGET_CPP_SPEC): Delete.
    * config/arm/t-wince-pe (pe.o): Add expr.h to dependencies.
    (cegcc1.o): Delete build rule.
    (MULTILIB_OPTIONS): Remove -mfpu=vfp.
    (TARGET_LIBGCC2_CFLAGS): Remove unneeded options.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to