1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7struct foo { 8 int x, thread_index; 9} glob; 10struct foo* camkes_get_tls(void) 11{ 12 return &glob; 13} 14_Noreturn void abort(void); 15 16static int a1; 17static int a2; 18static int *get(void) __attribute__((__unused__)); 19static int *get(void) { 20 switch (camkes_get_tls()->thread_index) { 21 case 1: 22 return &a1; 23 case 2: 24 return &a2; 25 default: 26 (void)0; 27 abort(); 28 } 29} 30