linker

gcc x86-32 stack alignment and calling printf

旧城冷巷雨未停 提交于 2020-08-26 08:36:40
问题 To the best of my knowledge, x86-64 requires the stack to be 16-byte aligned before a call, while gcc with -m32 doesn't require this for main. I have the following testing code: .data intfmt: .string "int: %d\n" testint: .int 20 .text .globl main main: mov %esp, %ebp push testint push $intfmt call printf mov %ebp, %esp ret Build with as --32 test.S -o test.o && gcc -m32 test.o -o test . I am aware that syscall write exists, but to my knowledge it cannot print ints and floats the way printf

How to statically link VCPKG produced .lib file in Visual Studio

旧城冷巷雨未停 提交于 2020-08-24 08:26:12
问题 I use VCPKG to build third party libraries like libcurl for example. I have dynamic and static builds. Obviously, import .lib and object .lib files are contained in two different folders, x64-windows and x64-windows-static respectively. I want to link object libcurl.lib statically with my program, but cannot figure out how to configure Visual Studio to do it. It always ends up using the import lib, rather than object lib and thus my program ends up requiring libcurl.dll at execution. I have

Undefined reference to global variable during linking

走远了吗. 提交于 2020-08-21 08:30:40
问题 I am trying to compile a program which is divided into 3 modules, corresponding to 3 source files: a.c , b.c , and z.c . z.c contains the main() function, which calls functions in a.c and b.c . Furthermore, a function in a.c calls a function in b.c , and viceversa. Finally, there is a global variable count which is used by the three modules and is defined in a separate header file, global.h . The code of the source files is the following: a.c #include "global.h" #include "b.h" #include "a.h"

Undefined reference to global variable during linking

99封情书 提交于 2020-08-21 08:29:18
问题 I am trying to compile a program which is divided into 3 modules, corresponding to 3 source files: a.c , b.c , and z.c . z.c contains the main() function, which calls functions in a.c and b.c . Furthermore, a function in a.c calls a function in b.c , and viceversa. Finally, there is a global variable count which is used by the three modules and is defined in a separate header file, global.h . The code of the source files is the following: a.c #include "global.h" #include "b.h" #include "a.h"

Swift: how to fully strip internal/inline symbols?

Deadly 提交于 2020-08-21 04:51:33
问题 I need to write some license checking code in Swift. I know Swift is not optimal for that kind of code in the first place, as it is harder to obfuscate. But if the code that needs to know whether the app is registered is written in Swift, this is still better than putting the license checking code in a separate framework that can be swapped out. To make attacking that code harder, I'm trying to obfuscate the code by at least removing the symbols related to it. For this, I have some inlined