@@ -122,8 +122,14 @@ static void write_header_defines(FILE *out, const char *elf_file, struct elf_fil
122122 fprintf (out , "#define HAS_INIT_ARRAY %d\n" , elf_has_section (elf , ".init_array" ) ? 1 : 0 );
123123 fprintf (out , "#define HAS_FINI_ARRAY %d\n" , elf_has_section (elf , ".fini_array" ) ? 1 : 0 );
124124 fprintf (out , "#define HAS_CLOCK %d\n" , elf_has_symbol (elf , "_clock" ) ? 1 : 0 );
125- fprintf (out , "#define HAS_ABORT %d\n" , elf_has_symbol (elf , "_abort" ) ? 1 : 0 );
126- fprintf (out , "#define HAS_EXIT %d\n" , elf_has_symbol (elf , "_exit" ) ? 1 : 0 );
125+ #if 0
126+ fprintf (out , "#define HAS_ABORT %d\n" , elf_has_symbol (elf , "_abort" ) ? 1 : 0 );
127+ fprintf (out , "#define HAS_EXIT %d\n" , elf_has_symbol (elf , "_exit" ) ? 1 : 0 );
128+ #else
129+ // elf_has_symbol has some false negatives, so always emit these functions for now.
130+ fprintf (out , "#define HAS_ABORT %d\n" , /* _abort */ 1 );
131+ fprintf (out , "#define HAS_EXIT %d\n" , /* _exit */ 1 );
132+ #endif
127133 fprintf (out , "#define HAS_C99__EXIT %d\n" , elf_has_symbol (elf , "__Exit" ) ? 1 : 0 );
128134 fprintf (out , "#define HAS_RUN_PRGM %d\n" , elf_has_symbol (elf , "_os_RunPrgm" ) ? 1 : 0 );
129135 fprintf (out , "#define HAS_MAIN_ARGC_ARGV %d\n" , elf_has_defined_symbol (elf , "___main_argc_argv" ) ? 1 : 0 );
0 commit comments