1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-21 23:27:39 +01:00

Define and use `NOINLINE'

This commit is contained in:
Tommi Rantala 2012-09-19 12:39:26 +03:00
parent 397f32a378
commit e3e49dc28a
5 changed files with 23 additions and 19 deletions

View file

@ -33,6 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef __GNUC__
# define ALIGNED(x) __attribute__((aligned(x)))
# define UNUSED __attribute__((unused))
# define NOINLINE __attribute__((noinline))
# define NORETURN __attribute__((noreturn))
# define ALIAS(name) __attribute__((alias (#name)))
# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
@ -55,6 +56,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define ALIGNED(x)
# define ALWAYS_INLINE
# define UNUSED
# define NOINLINE
# define NORETURN
# define ALIAS(name)
# define HIDDEN

View file

@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <unistd.h>
#include <libunwind.h>
#include "compiler.h"
#include <sys/resource.h>
#include <sys/time.h>
@ -53,7 +54,7 @@ gettime (void)
return tv.tv_sec + 1e-6*tv.tv_usec;
}
static int __attribute__((noinline))
static int NOINLINE
measure_unwind (int maxlevel, double *step)
{
double stop, start;
@ -88,7 +89,7 @@ measure_unwind (int maxlevel, double *step)
static int f1 (int, int, double *);
static int __attribute__((noinline))
static int NOINLINE
g1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)
@ -98,7 +99,7 @@ g1 (int level, int maxlevel, double *step)
return f1 (level + 1, maxlevel, step) + level;
}
static int __attribute__((noinline))
static int NOINLINE
f1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)

View file

@ -27,6 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <unistd.h>
#include <libunwind.h>
#include "compiler.h"
#include <sys/resource.h>
#include <sys/time.h>
@ -53,7 +54,7 @@ gettime (void)
return tv.tv_sec + 1e-6*tv.tv_usec;
}
static int __attribute__((noinline))
static int NOINLINE
measure_unwind (int maxlevel, double *step)
{
double stop, start;
@ -74,7 +75,7 @@ measure_unwind (int maxlevel, double *step)
static int f1 (int, int, double *);
static int __attribute__((noinline))
static int NOINLINE
g1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)
@ -84,7 +85,7 @@ g1 (int level, int maxlevel, double *step)
return f1 (level + 1, maxlevel, step) + level;
}
static int __attribute__((noinline))
static int NOINLINE
f1 (int level, int maxlevel, double *step)
{
if (level == maxlevel)

View file

@ -1,5 +1,7 @@
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include "compiler.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -9,12 +11,12 @@ int ok;
int verbose;
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 3)
void a (int, ...) __attribute__((noinline, optimize(0)));
void b (void) __attribute__((noinline, optimize(0)));
void c (void) __attribute__((noinline, optimize(0)));
void a (int, ...) __attribute__((optimize(0)));
void b (void) __attribute__((optimize(0)));
void c (void) __attribute__((optimize(0)));
#endif
void
void NOINLINE
b (void)
{
void *v[20];
@ -33,13 +35,13 @@ b (void)
printf ("[%d] %p\n", i, v[i]);
}
void
void NOINLINE
c (void)
{
b ();
}
void
void NOINLINE
a (int d, ...)
{
switch (d)

View file

@ -1,5 +1,7 @@
/* This program should crash and produce coredump */
#include "compiler.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@ -85,24 +87,20 @@ write_maps(char *fname)
#endif
#ifdef __GNUC__
int a(void) __attribute__((noinline));
int b(int x) __attribute__((noinline));
int c(int x) __attribute__((noinline, alias("b")));
int c(int x) NOINLINE __attribute__((alias("b")));
#define compiler_barrier() asm volatile("");
#else
int a(void);
int b(int x);
int c(int x);
#define compiler_barrier()
#endif
int a(void)
int NOINLINE a(void)
{
*(volatile int *)32 = 1;
return 1;
}
int b(int x)
int NOINLINE b(int x)
{
int r;