blob: fdde4b0acdad68f21545fea725f6ad8e6636a8d3 [file] [log] [blame]
%%{
/* --COPYRIGHT--,EPL
* Copyright (c) 2008 Texas Instruments and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Texas Instruments - initial implementation
*
* --/COPYRIGHT--*/
/* Linker templates are passed the following arguments:
* $out - an open file stream for the generated linker
* command file
* $args[] - array of zero or more libraries that should be linked
* with (in the order they appear in the argument list)
*
* The GNU linker accepts any text file as "command files", so there is no
* need to use a special option to identify them. In fact, if you use the
* -T option you must also include the default linker command file (which
* defines the memory map, sections, etc). By not using -T, this command
* file "accumulates" with the default.
*/
/* guess(!) the default leading prefix convention for this compiler */
var PREFIX = this.build.target.os == "Windows" ? "_" : "";
%%}
/* this file was generated by linkcmd.xdt from the gnu.targets package */
/* function aliases */
%if (prog.build.profile.match(/blas/) == null) {
% for (var keys = this.$$aliases.keys(); keys.hasMoreElements(); ) {
% var key = keys.nextElement();
`PREFIX + key` = `PREFIX + this.$$aliases.get(key)`;
% }
%}
/*
* symbolic aliases for numeric constants or static instance objects
*/
%for (var sym in Program.symbol) {
%var inst = Program.symbol[sym];
%if (typeof(inst) == 'number') {
`this.build.target.asmName(sym)` = `inst`;
%}
%else {
%var objTab = inst.$module.$name.replace(/\./g, '_') + '_Object__table__V';
%var off = Program.$capsule.instSize(inst) * inst.$index;
`this.build.target.asmName(sym)` = `this.build.target.asmName(objTab)` + `off`;
%}
%}
%if ($args.length > 0) {
/* input libraries */
INPUT(
%for (var i = 0; i < $args.length; i++) {
"`$args[i]`"
%}
)
%}
%var _utils = xdc.loadCapsule("gnu/targets/linkUtils.xs");
%/* Mingw compilers (4.4.0 for example) ignore COPY. */
%if (prog.build.target.$name != "gnu.targets.Mingw") {
SECTIONS {
`_utils.genSections(prog)`
}
%if (!prog.build.target.noStdLinkScript
% && prog.build.target.BINVERS >= "2.19") {
INSERT BEFORE .gnu.attributes
%}
%if ("xdc.runtime" in xdc.om && xdc.om['xdc.runtime.Text'].isLoaded != true) {
% var xv = Packages.xdc.services.intern.gen.Glob.vers().substr(9, 3);
% if (xv < "A58" || xv > "a00") {
ASSERT(ADDR(xdc.noload) + SIZEOF(xdc.noload) < ADDR(.rodata)
|| ADDR(.rodata) + SIZEOF(.rodata) < ADDR(xdc.noload),
"Sections .rodata and xdc.noload overlap. See xdc.runtime.Text.isLoaded for more.")
% }
%}
%} // end of the workaround for Mingw