+static ir_entity *create_compiler_lib_entity(const char *name, ir_type *type)
+{
+ ir_type *glob = get_glob_type();
+ ident *id = new_id_from_str(name);
+ ir_entity *entity;
+
+ /* Hack: we need to know the type of runtime library we use. Strictly
+ speaking it's not the same as the object-file-format. But in practice
+ the following should be enough */
+ if (be_gas_object_file_format == OBJECT_FILE_FORMAT_MACH_O
+ || be_gas_object_file_format == OBJECT_FILE_FORMAT_COFF) {
+ id = id_mangle3("___", id, "");
+ } else {
+ id = id_mangle3("__", id, "");
+ }
+ entity = new_entity(glob, id, type);
+ set_entity_visibility(entity, ir_visibility_local);
+ set_entity_ld_ident(entity, id);
+ return entity;
+}
+