augomat schrieb: > > hi! > > compiling a normal C programm, function-calls are (at least on my computer) > translated to something like: > > E8 56070000 CALL <JMP.&msvcrt.printf> > > where the operand 1 (56070000) is of type: rel16/32 > > can i force gcc to produce only CALLS (and jumps, ...) that have absolute > addresses as their operands? >
This is not a direct GCC thing, the final binary instruction form is created by the assembler (not part of GCC) or the linker (not part of GCC). GCC does not directly tell these programs to create a certain binary encoding (for a call or jump or any instruction), GCC just passes down asm text, they figure out what do generate them self, and when symbols are involved (function names, jump labels), and they generally are, symbol arithmetic is done (the assembler creating direct relative jumps if it is within the file, otherwise he creates relocation entries the linker resolves. Relocations can also be absolute, but on x86 the relative is favored, because it can reach the whole address range). If You or GCC would pass down "jmp 0x456789", then you would get your absolute jump, but then you would jump somewhere, and not to a defined symbol. Since GCC drives the assembler and the linker, there are some options to change their settings or pass options down to them (-Wl, -Wa). But i guess in this case you are out of luck, i can't find any option which would do what you want (relative branches are generally seen profitable and generally there is no reason to turn them off), neither on GCCs side, nor on the side of the GNU binutils (as, ld). (at least for x86, some RISC targets have -mlong-calls, due to fixed instruction lengths the relative addressing range is limited, so one can force to always use the long form, i think there is also no -relax option for x86) Esp. if the ABI dictates the code should be position independent, then relative jumps and calls are a major way to achieve this. You may test -fno-pie, -fno-pic, -fno-PIE or -fno-PIC. Maybe i missed the magic option, i only looked briefly over the man pages. Maybe you can describe what you are trying to achieve? There may be a another solution to that problem. > > best regards, > georg > > Greetings Jan _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org https://lists.gnu.org/mailman/listinfo/help-gplusplus