0

I have to patch my SW. The SW is a bunch of C-programs. The patch contains 3 kinds of files - *.S, *.c and *.sym. I have no issues with the *.S and *.c but I have trouble with the *.sym files. How do I compile the *.sym files?

For example, if you look into the glibc code, it contains *.S and *.sym files. The Makfiles somehow convert these *.sym files into a *.h file. The generated *.h files are then used inside the *.c or *.S files.

rkbug
  • 1
  • 2
  • The .sym is probably a debug symbol file, which usually aren't needed for compiling – SameOldNick Jul 26 '16 at 00:59
  • Thanks jxh but this is not the same as the link you provided. For example, if you look into the glibc code, it contains *.S and *.sym files. The Makfiles somehow convert these *.sym files into a *.h file. The generated *.h files are then used inside the *.c or *.S files. – rkbug Jul 27 '16 at 01:56
  • @rkbug I found an answer. It's not gcc problem, it's about glibc. In glibc source code, there is file `Makerules` which contains rule for converting `.sym` files. First it use `awk -f scripts/gen-as-const.awk ucontext_i.sym` (use `ucontext_i.sym` as example). It will generator one `.c` file witch conatin some things like `asm ("@@@name@@@oRBP@@@value@@@%0@@@end@@@" : : "i" ((long) mreg (RBP)));`. Then use command like `gcc -S -o xx -x c xx.c` generator things like `@@@name@@@oRBP@@@value@@@$120@@@end@@@`. Then with some `sed` magic and get `#define oRBP 120`. – randomeval Nov 19 '21 at 03:54

0 Answers0