fix some assertions; correctly handle weak symbols
authorMatthias Braun <matze@braunis.de>
Wed, 3 Feb 2010 20:03:00 +0000 (20:03 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 3 Feb 2010 20:03:00 +0000 (20:03 +0000)
[r27031]

ast2firm.c
attribute.c
entity_t.h

index bc2844f..e699f4a 100644 (file)
@@ -902,6 +902,9 @@ static void handle_decl_modifiers(ir_entity *irentity, entity_t *entity)
        if (modifiers & DM_USED) {
                add_entity_linkage(irentity, IR_LINKAGE_HIDDEN_USER);
        }
+       if (modifiers & DM_WEAK) {
+               add_entity_linkage(irentity, IR_LINKAGE_WEAK);
+       }
 }
 
 static bool is_main(entity_t *entity)
index 9385333..eca3f61 100644 (file)
@@ -310,6 +310,7 @@ void handle_entity_attributes(const attribute_t *attributes, entity_t *entity)
                case ATTRIBUTE_GNU_UNUSED:        modifiers |= DM_UNUSED; break;
                case ATTRIBUTE_GNU_DLLIMPORT:     modifiers |= DM_DLLIMPORT; break;
                case ATTRIBUTE_GNU_DLLEXPORT:     modifiers |= DM_DLLEXPORT; break;
+               case ATTRIBUTE_GNU_WEAK:          modifiers |= DM_WEAK; break;
 
                case ATTRIBUTE_MS_ALLOCATE:      modifiers |= DM_MALLOC; break;
                case ATTRIBUTE_MS_DLLIMPORT:     modifiers |= DM_DLLIMPORT; break;
index d609335..27e5c9d 100644 (file)
@@ -91,6 +91,7 @@ typedef enum decl_modifier_t {
        DM_DEPRECATED        = 1 << 24,
        DM_RETURNS_TWICE     = 1 << 25,
        DM_MALLOC            = 1 << 26,
+       DM_WEAK              = 1 << 27,
 } decl_modifier_t;
 
 /**