How can I declare a global variable related to syscall routines without any issue?
Mon Dec 30 00:19:00 GMT 2019
I am trying to modify x86-64 syscall routines to behave conditionally by a
flag variable. To do that, I added simple if statements in the
internal_syscall macros to check the value of the flag.
However, since they are macros, I need to declare the flag variable as a
global variable somewhere, then add "extern int" declaration in all C files
which call syscalll macros, and the object code which has the declaration
should be linked to all the objs with "extern" statements.
The problem is that which C file is the best place to declare the flag as a
global variable that does not break anything and linked to all the sycall
related C files? I could modify makefiles to link the declared obj files to
be linked to all others, but I am not sure it's the correct way to do it.
More information about the Libc-help