aboutsummaryrefslogtreecommitdiffstats
path: root/mk/elf.mk
Commit message (Collapse)AuthorAgeFilesLines
* Makefile: make the handling of firmware selection a little sanerH. Peter Anvin2016-02-091-1/+1
| | | | | | Clean up the handling of firmware selection inside the Makefiles. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Makefile: Always use -mno-red-zone for EFISylvain Gault2015-11-271-2/+4
| | | | | | | | This option is mandatory when compiling for EFI as some event handlers may interupt the running code and use the space just above the reserved stack space. Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
* Makefiles: export the firmware type as a cpp variableH. Peter Anvin2014-02-271-2/+2
| | | | | | Export the firmware type as a cpp variable so we can #ifdef. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* cmenu: Add libmenu.c32 to $(C_LIBS)syslinux-6.02-pre15Matt Fleming2013-07-291-1/+1
| | | | | | | | The menu modules, display, text, etc, require libmenu.c32 to be listed as a dependency. Append to $(C_LIBS) in mk/elf.mk so that module Makefiles can make use of the suffix rules. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Merge tag 'syslinux-5.11-pre8' into firmwaresyslinux-6.02-pre1Matt Fleming2013-07-081-1/+1
|\ | | | | | | | | | | | | | | | | | | | | syslinux-5.11-pre8 Conflicts: NEWS com32/lib/Makefile core/conio.c mk/devel.mk mk/elf.mk
| * mk: include $(GCCWARN) when building ELF objectsMatt Fleming2013-07-051-1/+1
| | | | | | | | | | | | | | It's currently impossible to turn on dprintf() statements in com32/modules because $(GCCWARN) isn't used as part of $(CFLAGS). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | mk: reinstate -mregparm for BIOSMatt Fleming2013-06-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | There's still a bunch of assembly code that assumes we're building our C objects with -mregparm=3. For example, the code to transition from 16-bit real-mode mode to 32-bit protected mode assumes this. Violating this assumption leads to various hangs, caused by garbage function arguments. Put back -mregparm into CFLAGS that was removed in commit 8789d2689564 ("mk/embedded.mk: Don't use -mregparm in core"). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | ldlinux: use platform filename extensionMatt Fleming2013-05-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users are starting to package all Syslinux versions on one boot medium and are running into problems because all versions of ldlinux have the same filename, ldlinux.c32. The version of ldlinux.c32 compiled for bios will not work with efi32 or efi64, and vice versa. What we need is a way for the Syslinux core to know exactly which filename to load. Use the following extensions for the corresponding platforms, .c32 - bios .e32 - efi32 .e64 - efi64 Now all ldlinux variants can be kept in the same directory without causing any conflicts. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge tag 'syslinux-5.01' into firmwaresyslinux-6.00-pre4Matt Fleming2013-01-291-3/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile NEWS com32/cmenu/Makefile com32/elflink/ldlinux/Makefile com32/gfxboot/Makefile com32/gpllib/Makefile com32/include/sys/module.h com32/lib/Makefile com32/lib/sys/module/elf_module.c com32/menu/Makefile com32/rosh/Makefile com32/samples/Makefile core/init.c mk/elf.mk Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * Rename libcom32gpl.c32 to libgpl.c32H. Peter Anvin2013-01-171-1/+1
| | | | | | | | | | | | Conform to 8.3 filenames for essential files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * Rename libutil_com.c32 to libutil.c32H. Peter Anvin2013-01-171-1/+1
| | | | | | | | | | | | Conform to 8.3 filenames for essential files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * Always strip all the modulesH. Peter Anvin2013-01-171-1/+5
| | | | | | | | | | | | | | | | Always strip the modules; they are too big unstripped. Specifically, we generate unstripped *.elf files, and then convert them to stripped *.c32 files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Merge tag 'syslinux-5.00-pre9' into for-hpa/elflink/firmwareMatt Fleming2012-11-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | This merge also includes the Syslinux-4.06 release. Conflicts: Makefile com32/hdt/Makefile com32/modules/Makefile com32/samples/hello.c mtools/Makefile
| * Clean up $(GPLLIB) leakMatt Fleming2012-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modules were linking against com32/gpllib/libcom32gpl.c32 even when NOGPL was set, so remove it from various modules Makefiles and use $(C_LIBS) in mk/elf.mk which already has the conditional-magic for $(GPLLIB). Also, the object files in com32/gpllib/ are not distributed in the release tarballs, which means that if a user does a 'make netinstall' they hit the following install error, install: cannot stat `com32/gpllib/*.c32': No such file or directory Add a $(INSTALLABLE_MODULES) variable to separate the list of build and install modules. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Add per-firmware object directory supportMatt Fleming2012-10-161-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have multiple firmware backends it no longer makes sense to write object files to the same directory as their source. A better solution is to write the object files to a per-firmware directory under a top-level object directory. The top-level object directory can be specified on the command-line with the O= variable, e.g. make O=/tmp/obj. If no top-level object directory is specified an 'obj' directory is created in the top-level of the Syslinux source repository. All the existing make targets continue to work as before, however now they apply to all firmware backends, e.g. 'make installer' will build the BIOS, 32-bit EFI and 64-bit EFI installers and place them under $(OBJ)/bios, $(OBJ)/efi32 and $(OBJ)/efi64 respectively. Note unlike every other bit of Syslinux, the gpxe objects are still kept in the src directory, e.g. gpxe/src, since gpxe is only required by the BIOS backend. It is possible to specify a make target for a specific firmware or list of firmware with the following syntax, make [firmware[,firmware]] [target[,target]] To clean the object directory for just the BIOS firmware type, 'make bios clean' To build both the 32-bit and 64-bit EFI installers type, 'make efi32 efi64 installer' Since the Syslinux make infrastructure is now more complex a new file doc/building.txt has been created to explain how to build Syslinux. The top-level Makefile now exports some make variables for use in module Makefiles, - topdir - the top-level source directory of the Syslinux repository, e.g. /usr/src/syslinux - objdir - the top-level object directory for the firmware backend currently being built, e.g. /obj/syslinux/bios - SRC - the source directory in the Syslinux repository for the module currently being built, e.g. /usr/src/syslinux/com32/libupload - OBJ - the object directory for the module currently being built, e.g. /obj/syslinux/bios/com32/libupload Since we're rewriting the Makefile infrastructure anyway it seemed like a good idea to add parallel support. By writing subdirectories as prequisites for make targets the objects in those subdirectories can be built in parallel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge remote-tracking branch 'mfleming/elflink' into for-hpa/elflink/firmwareMatt Fleming2012-08-131-1/+1
|\| | | | | | | | | Conflicts: com32/lib/sys/module/common.c
| * com32: Use --as-needed for LDFLAGSMatt Fleming2012-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This extends commit 4678fd92a21e ("elflink: fix dependency problem in cmenu/Makefile") and basically reverts commit fb543aa635ff ("com32: Per-object file LDFLAGS"). By using the --as-needed ld argument we can specify all the required shared libraries for a directory, even if not all of the libraries are needed by every .c32 file. --as-needed takes care of only creating DT_NEEDED entries for the shared libraries that are actually required to resolve undefined symbols in a given module. Furthermore, by using $(LIBS) we create a dependency between .c32 files and their shared libraries, which allows multiple make jobs to run in parallel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge remote-tracking branch 'mfleming/elflink' into for-hpa/elflink/firmwareMatt Fleming2012-07-301-5/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile com32/elflink/ldlinux/adv.c com32/elflink/ldlinux/kernel.c com32/elflink/ldlinux/ldlinux.c com32/include/bitsize/stddef.h com32/include/bitsize/stdint.h com32/include/stdint.h com32/include/sys/module.h com32/include/sys/x86_64/bitops.h com32/include/syslinux/linux.h com32/lib/Makefile com32/lib/sys/ansicon_write.c com32/lib/sys/module/elfutils.h com32/lib/sys/vesa/efi/fill.h com32/lib/syslinux/load_linux.c com32/lib/syslinux/serial.c com32/lib/syslinux/shuffle.c core/conio.c core/elflink/config.c core/elflink/load_env32.c core/graphics.c core/include/graphics.h core/init.c core/pxelinux.asm mk/elf.mk mk/lib.mk
| * elflink: fix dependency problem in cmenu/Makefilesyslinux-5.00-pre6H. Peter Anvin2012-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | Instead of adding library dependencies implicitly, make them explicit and use --as-needed to avoid bogus DT_NEEDED entries from being generated. The other Makefiles should be adjusted accordingly as well. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Cc: Matt Fleming <matt.fleming@intel.com>
| * com32: Per-object file LDFLAGSMatt Fleming2012-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Some object files need to link against the ELF libraries. Allow them to be specified with the following syntax in the Makefiles, LDFLAGS_$(object_file) = $(LIBS) By adding libraries in this way DT_NEEDED entries are created in the ELF modules and the required library dependencies are automatically loaded before running the module. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * Merge remote-tracking branch 'zytor/master' into merge/elflink/masterMatt Fleming2012-05-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of development has gone on in the 'master' branch since the last time we merged; new features, bug fixes, etc, etc. Conflicts: Makefile com32/Makefile com32/lib/Makefile com32/lib/syslinux/load_linux.c com32/modules/Makefile com32/modules/chain.c core/bootsect.inc core/init.inc version
| * pxe: resolve names via DNS from protected-mode codePaulo Alcantara2012-05-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | Syslinux used to call __intcall() for calling routines of the old COMBOOT API to resolve names via DNS (INT 22h, AX=0x0010) that seemed pointless, since INT 22h, AX=0x0010 does call the protected-mode function pm_pxe_resolv_dns() when calling INT 22h, AX=0x0010. So, for resolving names via DNS we must call pxe_dns_resolv() (a protected-mode function) instead for now. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
| * mk: Don't link against compiler's version of libgccMatt Fleming2012-03-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syslinux provides its own copy of libgcc functions in com32/lib/libgcc, so we don't need to link against the version provided by the compiler. What's worse, the behaviour is different between the two versions. This caused problems, for example, when parsing the TOTALTIMEOUT config directive in com32/menu because of the following calculation, totaltimeout = (atoll(skipspace(p + 13)) * CLK_TCK + 9) / 10; which invokes __divdi3() as provided by libgcc. The results returned by the Syslinux and compiler's copy of libgcc differ, leading to differences in behaviour. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | The make files have undergone changes to support both i386 and x86_64 platforms.chandramouli narayanan2012-06-251-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pertinent changes are sprinkled through *.mk and Makefile in the syslinux tree. Build architecture is specified at the command line via ARCH macro. This is to enable whether one is building for the native platform or cross-building for a different architecture. Currently, the only supported architectures via ARCH macro are i386 and x86_64. There are some modules (e.g. memdump) that don't build under the EFI environment. To go forward with efi boot support, a separate EFI_BUILD=1 macro has been added and is required to be specified while building. This is a temporary solution for the current build environment. example build: On a x86_64 platform, the following cross-builds syslinux for i386 To build for i386: make EFI_BUILD=1 ARCH=i386 On a x86_64 platform, the following builds syslinux for x86_64 To build natively: make EFI_BUILD=1 Changes specific to GCC and LD options: Architecture specific flags and include/search directories are set up for GCC and LD commands. Internally, GCC options such as stack-boundary, PIC and machine architecture are set up based on ARCH macro. While stack-boundary=2 is fine for i386, it does not work for x86_64 and so it is left to the default value. Using -fPIE with gcc does not work with ld on x86_64, but -fPIC works fine. Similarly, target and elf options are set up for linking as approrpriate for architecture. Assumption about gnu-efi install path: Since the EFI build supports both EFI32 and EFI64, the following assumptions are made with regard to the installed location of gnu-efi on the build platform. 1. gnu-efi-ia32: assumed installed in /usr/local [ EFI-32 include files in /usr/local/include/efi and gnu-efi library in /usr/local/lib/ ] 2. gnu-efi-x86_64: assumed installed in /usr [ EFI-64 include files in /usr/include/efi and gnu-efi library in /usr/lib64/ ] Remanants of the unused old i386-only files, if any, need to be pruned.
* | core: Do not use -mregparmMatt Fleming2011-12-161-1/+1
|/ | | | | | | When trying to integrate the old com32 code with EFI, EFI doesn't use mregparm. Using mregparm leads to incompatibilities with most 3rd party code anyway and it only results in a minimal space-saving at runtime. Pass all parameters on the stack by default.
* elflink: ldlinux should not have any dependenciesMatt Fleming2011-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | ldlinux currently requires the get_key() symbol, which means it has a dependency on libutil_com.c32. ldlinux.c32 really should be a standalone module so let's move get_key.c into ldlinux/. However, moving get_key.c creates a new problem - native linux applications such as com32/samples/keytest.c require the get_key() symbol which is currently exported by libutil_lnx.a. To fix this, we create a new native linux library that exports any required symbols from ldlinux. With this change we need to update com32/Makefile so that we build com32/elfink/ldlinux before com32/samples, and seeing as ldlinux now has no dependencies, we may as well move it to the front of $SUBDIRS. Also, update elf_gen_dep.sh to skip ldlinux.c32 and not search for dependencies for any of its unresolved symbols. This way, if anyone inadvertently introduces a dependency that cannot be resolved by the core, ldlinux.c32 will fail to load at runtime (which guarantees that the newly introduced dependency won't go unnoticed). Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: Make ELF the default object formatMatt Fleming2011-04-261-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | com32/elflink/modules was originally created to house ELF modules and keep them separate from the COM32 modules as the elflink branch was being developed. However, this has inadvertently created a maintenance nightmare because code was copied from elsewhere in the tree into com32/elflink/modules, resulting in duplication. Bug fixes have been going into the original code but have not been merged onto the elflink branch, leaving the duplicate code in com32/elflink/modules buggy. So let's delete this directory. There really is no reason to keep ELF and COM32 modules separate because there's no reason to need both COM32 and ELF modules to coexist. ELF is a far superior object file format and all modules are not emitted as ELF objects. Now that we're outputting ELF modules we can use dynamic memory instead of the cs_bounce bounce buffer. This commit requires a certain amount of shuffling for some files. quicksort.c isn't a module and belongs as part of the util library. cli.h belongs in com32/include so that other modules can make use of the cli code in ldlinux.c32. All libraries are now ELF shared libraries which are only loaded to fixup unresolved symbols for executable modules and renamed from *.a to *.c32. This reduces the runtime memory footprint because libraries are only loaded when needed and because every executable no longer gets its own copy of code/data (as it would if linking with a static library). Also, remove MINLIBOBJS from libcom32.c32 because it is already part of libcom32min.a and we don't want to have any duplicate symbols between the core (which links with libcom32min.a) and libcom32.c32. Welcome to the New World Order of ELF modules! Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* mk: Add rule for emitting .c32 ELF filesMatt Fleming2011-04-261-1/+3
| | | | | | | | | | We currently open code the Makefile rules for outputting .c32 files, so provide a pattern rule to make things easier. There are no users of this rule yet, but we'll make use of it when we switch all modules over to ELF. Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: Move elf MCONFIG to mk/elf.mkMatt Fleming2011-04-261-0/+69
Catch up with recent changes to the Makefile fragments in the MCONFIG files. Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>