Reputation: 1
I'm trying to compile the code below on a 32 bit Linux with GCC 4.4.1.
#ifndef WIN32
#define DEBUG_STOP_POINT() \
asm ( " 0 : int3 ; " \
" .pushsection embed-breakpoints ; " \
" .quad 0b ; " \
" .popsection ; " )
#if defined ( _DEBUG ) && defined ( _ASPECT_DEBUG )
#define THROW_BREAKPOINT() \
asm ( " 0 : int3 ; " \
" .pushsection embed-breakpoints ; " \
" .quad 0b ; " \
" .popsection ; " )
#else
#define THROW_BREAKPOINT() \
asm ( " 0 : .pushsection embed-breakpoints ; " \
" .quad 0b ; " \
" .popsection ; " )
#endif
#else
#define DEBUG_STOP_POINT()
#define THROW_BREAKPOINT()
#endif
It was taken from a 64 bit project running on the 64 bit version of the same Linux where it compiles without problems with the same GCC 4.4.1. Every place where THROW_BREAKPOINT()
(the DEBUG_STOP_POINT()
is never used) is used issues the compile error: "cannot represent relocation type BFD_RELOC_64."
And now the questions:
rpm -ivh --force
options)? In this case, could you give me am example of code using asm directives which should compile on my 32 bit box ?Upvotes: 0
Views: 1055
Reputation: 129474
1) Obviously, it's hard to tell exactly WHY the code is there without some context, but this is what it "does":
asm ( " 0 : int3 ; " \ # INT3 = Breakpoint instruction
" .pushsection embed-breakpoints ; " \
" .quad 0b ; " \ # Trap detection address
" .popsection ; " )
The pushsection and popsection change what section the data is in (by saving on a stack, and then restoring back to whatever it was originally (typically .text
, but obviously some other inline assembler or #pragma
may have changed that before this particular point.
For 32-bit code, you'd probably want a .long
instead of .quad
for the trap detection address - this would make this reference a 32-bit value rather than a 64-bit value - the linker won't like 64-bit values... I don't know exactly what the purpose of the embed-breakpoints
section is - it's presumably scanned to understand where the actual breakpoint happened, or some such. It stores the address of 0:
, in other words the address of the int3
instruction.
Obviously, the #if _DEBUG ...
bit is just a way to select a breakpoint for debug or no breakpoint variation of the code for non-debug mode.
2) You would really have to ask whoever wrote the code - didn't see a need for 32 bits, I expect.
3) Uh? We can't tell what you installed from what you have asked, and it's impossible to tell if it's installed "correctly" or not. As for examples, I'm pretty sure there are tutorials, but changing .quad
to .long
should fix the immediate error in the title of your post - of course, there are most likely some other code that actually uses this content that may also need to be changed.
4) Not sure what you are asking for here?
Note that I'm trying to read your mind in my answer, so apologies if my "force" is not strong today, and I have answered something else than what you asked for. It would REALLY help (for future reference) if you posted:
Upvotes: 2