reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
// RUN: %clang -fno-use-init-array -g -c %s -o %t.o
// RUN: %clang -fno-use-init-array -g -o %t -nostdlib %crt1 %crti %crtbegin %t.o -lc %libgcc %crtend %crtn
// RUN: %run %t 2>&1 | FileCheck %s

#include <stdio.h>

// CHECK:      ctor()
// CHECK-NEXT: main()
// CHECK-NEXT: dtor()

void __attribute__((constructor)) ctor() {
  printf("ctor()\n");
}

void __attribute__((destructor)) dtor() {
  printf("dtor()\n");
}

int main() {
  printf("main()\n");
  return 0;
}