Page MenuHomeFreeBSD
Paste P198

tls-align.c
ActivePublic

Authored by jrtc27_jrtc27.com on Jul 30 2018, 3:10 PM.
/* Compile and link as a dynamic executable. */
#include <stdio.h>
__thread int aligned_var_ie __attribute__((aligned(4096),tls_model("initial-exec"))) = 0x420043;
__thread int aligned_var_le __attribute__((aligned(4096),tls_model("local-exec"))) = 0x470048;
int main(int argc, char **argv) {
printf("&aligned_var_ie: 0x%lx\n", (long)&aligned_var_ie);
printf("aligned_var_ie: 0x%x\n", aligned_var_ie);
printf("&aligned_var_le: 0x%lx\n", (long)&aligned_var_le);
printf("aligned_var_le: 0x%x\n", aligned_var_le);
}