pc-bios/optionrom: Fix OpenBSD build with better detection of linker emulation
The various host OSes are irritatingly variable about the name of the linker emulation we need to pass to ld's -m option to build the i386 option ROMs. Instead of doing this via a CONFIG ifdef, check in configure whether any of the emulation names we know about will work and pass the right answer through to the makefile. If we can't find one, we fall back to not trying to build the option ROMs, in the same way we would for a non-x86 host platform. This is in particular necessary to unbreak the build on OpenBSD, since it wants a different answer to FreeBSD and we don't have an existing CONFIG_ variable that distinguishes the two. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Sean Bruno <sbruno@freebsd.org> Message-id: 1470672688-6754-1-git-send-email-peter.maydell@linaro.org
This commit is contained in:
		
							parent
							
								
									dfd6076710
								
							
						
					
					
						commit
						e57218b6ed
					
				
							
								
								
									
										12
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @ -4699,7 +4699,16 @@ roms= | ||||
| if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ | ||||
|         "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ | ||||
|         "$softmmu" = yes ; then | ||||
|   roms="optionrom" | ||||
|     # Different host OS linkers have different ideas about the name of the ELF | ||||
|     # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd | ||||
|     # variant; and Windows uses i386pe. | ||||
|     for emu in elf_i386 elf_i386_fbsd i386pe; do | ||||
|         if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then | ||||
|             ld_i386_emulation="$emu" | ||||
|             roms="optionrom" | ||||
|             break | ||||
|         fi | ||||
|     done | ||||
| fi | ||||
| if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then | ||||
|   roms="$roms spapr-rtas" | ||||
| @ -5539,6 +5548,7 @@ fi | ||||
| echo "LDFLAGS=$LDFLAGS" >> $config_host_mak | ||||
| echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak | ||||
| echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak | ||||
| echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak | ||||
| echo "LIBS+=$LIBS" >> $config_host_mak | ||||
| echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak | ||||
| echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak | ||||
|  | ||||
| @ -48,18 +48,8 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin | ||||
| %.o: %.S | ||||
| 	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"  AS    $(TARGET_DIR)$@") | ||||
| 
 | ||||
| ifdef CONFIG_WIN32 | ||||
| LD_EMULATION = i386pe | ||||
| else | ||||
| ifdef CONFIG_BSD | ||||
| LD_EMULATION = elf_i386_fbsd | ||||
| else | ||||
| LD_EMULATION = elf_i386 | ||||
| endif | ||||
| endif | ||||
| 
 | ||||
| %.img: %.o | ||||
| 	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"  Building $(TARGET_DIR)$@") | ||||
| 	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"  Building $(TARGET_DIR)$@") | ||||
| 
 | ||||
| %.raw: %.img | ||||
| 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"  Building $(TARGET_DIR)$@") | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Peter Maydell
						Peter Maydell