Commit 776cf554 authored by Siarhei Siamashka's avatar Siarhei Siamashka Committed by Bernhard Nortmann
Browse files

Fix compatibility with Linaro toolchains for building ARM binaries



Add DISCARD directives to the linker scripts and also -marm option
to GCC command line. Without this, certain toolchains may build
Thumb2 code by default. Also junk sections may be present in the
final binary and they need to be removed.

This helps at least when using the following Linaro toolchain:
gcc-linaro-5.1-2015.08-x86_64_arm-linux-gnueabihf.tar.xz
Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
Reviewed-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent bbdae674
...@@ -121,7 +121,7 @@ sunxi-%: %.c ...@@ -121,7 +121,7 @@ sunxi-%: %.c
fel-pio.bin: fel-pio.elf fel-pio.nm fel-pio.bin: fel-pio.elf fel-pio.nm
ARM_ELF_FLAGS = -Os -fpic -Wall ARM_ELF_FLAGS = -Os -marm -fpic -Wall
ARM_ELF_FLAGS += -fno-common -fno-builtin -ffreestanding -nostdinc ARM_ELF_FLAGS += -fno-common -fno-builtin -ffreestanding -nostdinc
ARM_ELF_FLAGS += -mno-thumb-interwork -fno-stack-protector -fno-toplevel-reorder ARM_ELF_FLAGS += -mno-thumb-interwork -fno-stack-protector -fno-toplevel-reorder
ARM_ELF_FLAGS += -Wstrict-prototypes -Wno-format-nonliteral -Wno-format-security ARM_ELF_FLAGS += -Wstrict-prototypes -Wno-format-nonliteral -Wno-format-security
......
...@@ -14,10 +14,15 @@ ...@@ -14,10 +14,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
SECTIONS
{
. = 0x40007000;
.text : { *(.text) }
}
SECTIONS
{
. = 0x40007000;
.text : { *(.text) }
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}
...@@ -14,10 +14,15 @@ ...@@ -14,10 +14,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
SECTIONS
{
. = 0x2000;
.text : { *(.text) }
}
SECTIONS
{
. = 0x2000;
.text : { *(.text) }
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}
...@@ -14,10 +14,15 @@ ...@@ -14,10 +14,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
SECTIONS
{
. = 0x0030;
.text : { *(.text) }
}
SECTIONS
{
. = 0x0030;
.text : { *(.text) }
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}
...@@ -14,10 +14,15 @@ ...@@ -14,10 +14,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
SECTIONS
{
. = 0x0030;
.text : { *(.text) }
}
SECTIONS
{
. = 0x0030;
.text : { *(.text) }
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment