[librm] Ensure that inline code symbols are unique

Commit 6149e0a ("[librm] Provide symbols for inline code placed into
other sections") may cause build failures due to duplicate label names
if the compiler chooses to duplicate inline assembly code.

Fix by using the "%=" special format string to include a
guaranteed-unique number within the label name.

The "%=" will be expanded only if constraints exist for the inline
assembly.  This fix therefore requires that all REAL_CODE() fragments
use a (possibly empty) constraint list.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2018-03-21 16:47:33 +02:00
parent 6149e0af3c
commit bc85368cdd
6 changed files with 9 additions and 9 deletions

View File

@@ -521,12 +521,12 @@ static void bios_inject_startup ( void ) {
__asm__ __volatile__ (
TEXT16_CODE ( "\nint16_wrapper:\n\t"
"pushfw\n\t"
"cmpb $0, %cs:bios_inject_lock\n\t"
"cmpb $0, %%cs:bios_inject_lock\n\t"
"jnz 1f\n\t"
VIRT_CALL ( bios_inject )
"\n1:\n\t"
"popfw\n\t"
"ljmp *%cs:int16_vector\n\t" ) );
"ljmp *%%cs:int16_vector\n\t" ) : );
/* Hook INT 16 */
hook_bios_interrupt ( 0x16, ( ( intptr_t ) int16_wrapper ),

View File

@@ -48,7 +48,7 @@ static void bios_reboot ( int warm ) {
put_real ( flag, BDA_SEG, BDA_REBOOT );
/* Jump to system reset vector */
__asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) );
__asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : );
}
/**