makerpl[32|64] - Make RPX or RPL

Syntax

makerpl[32|64] [<option>...] [<file>.elf]

Options

-zx Do not compress (default is to compress). May hamper disassembly of the RPX/RPL file with ELF dump tools. See -s option also.
-z[1-9] Compression level. Default is 6.
-f Force as RPX (required to build RPXs).
-d Deprecated. Set dynamic-only flag in file info.
-s Strip function symbols that are not imported or exported.
-new New, smaller RPL symbol table. Default.
-old Use old larger method for generating the symbol table.
-h <n> Override the default system heap size with new value <n> in bytes. Default heap size is 32 KB.
-checknosda Verify that the RPX/RPL does not use a Small Data Area.
-stack <n> Override the default initial stack size with new value <n> in bytes. Default is 64 KB.
-l <file> Compatibility for pre-v1.0 RPL Tools. Specify the output import library file (.a).
-v Print verbose info.
-warnemptyrela Emit a warning if a relocation section points to the NULL section and has empty relocations.
-t BUILD_TYPE=<build_type> Embed BUILD_TYPE information into the output file. A string “DEBUG” or “NDEBUG” is assignable to <build_type>. This option is required when the output is an RPX file.
-nolib Disable generation of the import library. Always use this option if preprpl[32|64] is used to build the import library
-padall <n> Pad the TEXT, DATA, LOAD and TEMP sections by <n> percent.
-sizedata <n> Set data area to <n> bytes. Must also set -sizetext <n> -sizeload <n> -sizetemp <n>.
-sizetext <n> Set text area to <n> bytes. Must also set -sizedata <n> -sizeload <n> -sizetemp <n>.
-sizeload <n> Set load area to <n> bytes. Must also set -sizedata <n> -sizetext <n> -sizetemp <n>.
-sizetemp <n> Set temp area to <n> bytes. Must also set -sizedata <n> -sizetext <n> -sizeload <n>.
-sizefileinfo <n> FileInfo set to <n> bytes. Can be used independently of other padding options. FileInfo must be at least 96 bytes.
-dbg_source_root <dir> <dir> is a file path (Windows, Cygwin or mixed). Review all source roots passed to makerpl[32|64] to use the first one that matches up with the input ELF file to create a relative path in the FileInfo. $(CAFE_ROOT)/system is added implicitly by the Nintendo makefile build system and additional paths may be added.

Description

This Windows tool is provided in two flavors: makerpl32.exe and makerpl64.exe for 32-bit and 64-bit operating systems, respectively.

makerpl[32|64] is called after linking. It takes an ELF file from the linker and generates either an RPX or RPL file.

The tool preprpl[32|64] should be used to generate import libraries (“.a” files).

For compatibility with application build systems that rely on the pre-v1.0 RPL tools, makerpl[32|64] can still generate import libraries. These libraries can still be used by other RPX or RPL files to import symbols from previously built modules.

-dbg_source_root <dir> creates relative (partial) paths in the FileInfo instead of absolute paths. Relative paths make it easier to debug RPLs that have been moved from their build directory as well as allow better comparison of dumprpl disassemblies of different revisions of a RPL. $(CAFE_ROOT)/system is added implicitly by the Nintendo makefile build system and additional paths may be added.

Disassembly of RPX/RPL Files

RPX and RPL files contain vendor specific sections, section flags, and types that may be incompatible with some ELF dump tools. To disassemble an RPX/RPL file, use the -zx flag. Do not use the -s flag. This will improve the chances for correct disassembly; however, some vendor specific elements may still cause issues. We apologize for the inconvenience.

NOTE:
The BUILD_TYPE information embedded into RPX files by makerpl[32|64] is referenced by makecfmaster during the mastering phase. If an RPX file is created without the -t BUILD_TYPE=<build_type> option, makecfmaster cannot embed correct information into the master archive, and the application may not run as a WUMAD file.
IMPORTANT:
The following examples reference the Examplemake demo package. The package demonstrates various aspects of the build system, including the latest RPL tool enhancements. The version of Examplemake included in the SDK is compatible with the current SDK. For comparison with older SDK versions, obtain the Examplemake package from your local Nintendo developer support group.

Example

The Examplemake demos illustrate how to use makerpl[32|64] to create RPX and RPL files. For convenience, we will use the definitions below to describe the various parameters for building the example.

Definitions for makerpl[32|64] Commands for RPX and RPL

CAFE_TOOL_DIR $(CAFE_SDK_DIR)/system/bin/tool
LIB_DIR $(CAFE_SDK_DIR)/system/lib/ghs/cafe/$(BUILD_TARGET)

To create an RPX:

$(CAFE_TOOL_DIR)/makerpl64 hello.elf -f -nolib -t BUILD_TYPE=DEBUG
$(CAFE_TOOL_DIR)/makerpl64 hello.elf -f -nolib -t BUILD_TYPE=NDEBUG

To create an RPL:

$(CAFE_TOOL_DIR)/makerpl64 world.elf -checknosda -nolib

The major differences between making an RPX versus an RPL are:

  1. To build the RPX, the -f option is required.
  2. To build the RPX, the -t BUILD_TYPE=<build_type> option is required, where <build_type> is DEBUG or NDEBUG.
  3. The -checknosda option is required for RPLs, to ensure that Small Data Area references are not used. This option can be used for RPXs as well, if all of its constituent files have been compiled with the -sda=none option.

Build Procedures

This section outlines the build process for several different scenarios. For convenience, we will use the definitions below to describe the various parameters for building RPX and RPL files.

Definitions for Building RPXs

RPX_OBJS All constituent .o files needed by your RPX.
RPX_SYS_RPLS All of the system RPLs needed by your RPX.
RPX_LCF The linker definition file. The default is $(CAFE_ROOT)/system/include/cafe/eppc.Cafe.ld.

Definitions for Building RPLs

RPL_OBJS All constituent .o files needed by your RPL.
RPL_SYS_RPLS All the system RPLs needed by your RPL.
RPL_LCF The linker definition file. The default is $(CAFE_ROOT)/system/include/cafe/eppc.Cafe.rpl.ld.

Building a Monolithic Application

In this scenario, based on the Examplemake demo program helloworld, we build a monolithic application RPX which only links against system RPLs.

  1. Compile application files helloworld.o.
  2. Invoke the linker:
    • Inputs: helloworld.o $(RPX_SYS_RPLS) $(RPX_LCF)
    • Output: helloworld.o
  3. Invoke makerpl[32|64]:
    • Inputs : $(RPX_ELF)
    • Outputs: helloworld.rpx

In this scenario, helloworld exports no symbols; therefore preprpl[32|64] is not invoked and no import library is generated.

RPX and RPL Sharing Symbols

In this scenario, the application RPX is linked against an RPL (in addition to the system RPLs). The RPX exports a symbol that is referenced by the constituent RPL. And the RPL exports a symbol that is referenced by the RPX.

  1. Invoke preprpl[32|64] for hello.rpx:
    • Inputs : hello.def
    • Outputs: hello_rpl_exports.o hello.a
  2. Invoke preprpl[32|64] for world.rpl:
    • Inputs : world.def
    • Outputs: world_rpl_exports.o world.a
  3. Compile the RPL file world.c.
  4. Invoke the linker for world.rpl:
    • Inputs: world_rpl_exports.o world.o $(RPL_SYS_RPLS) hello.a $(RPL_LCF)
    • Output: world.elf
  5. Invoke makerpl[32|64] for world.rpl:
    • Inputs : world.elf
    • Outputs: world.rpl
  6. Compile the RPX file hello.c.
  7. Invoke the linker for hello.rpx:
    • Inputs: hello_rpl_exports.o hello.o $(RPL_SYS_RPLS) world.a $(RPL_LCF)
    • Output: hello.elf
  8. Invoke makerpl[32|64] for hello.rpx:
    • Inputs : hello.elf
    • Outputs: hello.rpx

In this scenario, $(RPX_IMPORTS) is passed to preprpl[32|64] and the linker.

Cross Referencing

Exporting and importing symbols simultaneously between two modules is supported. For more information, see RPX/RPL Cross-Referencing.

RPL Padding

The system currently pads RPLs by 10%. To change this behavior, define MAKERPL_PAD in the makefile. For example:

NO_RPL_PAD := # no padding
MAKERPL_PAD := -padall 1 # 1% padding
MAKERPL_PAD := -sizedata 10000 -sizetext 50000 -sizeload 40000 -sizetemp 600 # pad each segment to specific sizes.
NOTE:
The value of <n> in -sizedata <n> -sizetext <n> -sizeload <n> -sizetemp <n> have to be aligned to the segment. Errors are returned if the value is not aligned.

RPL Symbol Table

The RPL symbol table is trimmed down from the input elf file to only include:

Relocations with-in the RPX/RPL are rewritten to use the $TEXT and $DATA symbols instead of the original symbols. This allows a greatly reduced symbol table size. If the new method of generating the symbol table causes problems the old algorithm can be used with the -old option.

Using the -s option causes the function symbols to not be included (unless they are imported or exported).

See Also

RPX/RPL Overview
RPX/RPL Cross-Referencing
Building with Examplemake
preprpl[32|64]
rplexportall
dumprpl

Revision History

2014/07/08 Replaced makecfmaster.sh with makecfmaster.exe.
2014/01/16 Minor text additions.
2013/12/06 Added missing and new options.
2013/08/06 Removed references to older SDKs.
2013/05/08 Automated cleanup pass.
2012/08/31 Added the necessity of BUILD_TYPE information.
2012/07/23 Removed references to old SDKs. Updated Examplemake references.
2011/10/19 Examplemake addition.
2011/02/21 Initial version.


CONFIDENTIAL