]> Git Repo - elf2flt.git/log
elf2flt.git
17 months agoxtensa: fix text relocations main
Max Filippov [Wed, 30 Nov 2022 01:47:54 +0000 (17:47 -0800)]
xtensa: fix text relocations

The commit 5e08f1968316 ("Don't always update text in !pic_with_got case")
changed good_32bit_resolved_reloc to not do endianness swapping for
relocated entries in the text segment. This broke little-endian xtensa
FLAT images which after this change fail to start with the following
message:

  binfmt_flat: reloc outside program 0x24c80100 (0 - 0x6e430/0x56a20)

Fix it by preserving 'update_text' when building for xtensa.

Fixes: 5e08f1968316 ("Don't always update text in !pic_with_got case")
Reported-by: Niklas Cassel <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
17 months agoelf2flt: add riscv 64-bits support
Damien Le Moal [Wed, 9 Sep 2020 08:31:33 +0000 (17:31 +0900)]
elf2flt: add riscv 64-bits support

Add support for riscv 64bits ISA by defining the relocation types
R_RISCV_32_PCREL, R_RISCV_ADD32, R_RISCV_SUB32, R_RISCV_32 and
R_RISCV_64. riscv64 support also needs the __global_pointer$ symbol to
be defined right after the relocation tables in the data section. To
define this symbol, the "RISCV_GP" line prefix is added. The "RISCV_GP"
string is removed if the target CPU type is riscv64 and the definition
line is dropped for other CPU types.

With these changes, buildroot and busybox build and run on riscv NOMMU
systems with Linux kernel including patch 6045ab5fea4c
("binfmt_flat: do not stop relocating GOT entries prematurely on riscv")
fixing the binfmt_flat loader. Tested on QEMU and Canaan Kendryte K210
boards.

This patch is based on earlier work by Christoph Hellwig <[email protected]>.

Signed-off-by: Damien Le Moal <[email protected]>
17 months agoelf2flt.ld: reinstate 32 byte alignment for .data section
Niklas Cassel [Mon, 4 Apr 2022 13:30:24 +0000 (15:30 +0200)]
elf2flt.ld: reinstate 32 byte alignment for .data section

Commit 8a3e74446fe7 ("allow to build arm flat binaries") moved the
following commands:
. = ALIGN(0x20) ;
@SYMBOL_PREFIX@_etext = . ;
from the .text section to the top level in the SECTIONS node.

The .text output section is being directed to a memory region using the
"> flatmem :text" output section attribute. Commands in the top level in
the SECTIONS node are not.

This means that the ALIGN() command is no longer being appended to the
flatmem memory region, it will simply update the Location Counter.

The heuristic for placing an output section is described here:
https://sourceware.org/binutils/docs-2.38/ld.html#Output-Section-Address

"If an output memory region is set for the section then it is added to this
region and its address will be the next free address in that region."

Since the .data section is being directed to the same memory region as the
.text section, this means that the Location Counter is not used when
assigning an address to the .data output section, it will simply use the
next free address.

No longer directing these commands to the flatmem memory region means that
the .data output section is no longer aligned to a 32 byte boundary.

Before commit 8a3e74446fe7 ("allow to build arm flat binaries"):
$ readelf -S busybox_unstripped.gdb | grep data
  [ 3] .data             PROGBITS         0000000000035ac0  00036ac0
$ readelf -s busybox_unstripped.gdb | grep _etext
 19286: 0000000000035ac0     0 NOTYPE  GLOBAL DEFAULT    1 _etext

After commit 8a3e74446fe7 ("allow to build arm flat binaries"):
$ readelf -S busybox_unstripped.gdb | grep data
  [ 3] .data             PROGBITS         0000000000035ab0  00036ab0
$ readelf -s busybox_unstripped.gdb | grep _etext
 19287: 0000000000035ac0     0 NOTYPE  GLOBAL DEFAULT    3 _etext

The .data output section has to be aligned to a 32 byte boundary, see the
FLAT_DATA_ALIGN 0x20 macro and its usage in fs/binfmt_flat.c:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/binfmt_flat.c?h=v5.17#n59

Readd an explicit ALIGN attribute on the .data section itself, since the
linker will obey this attribute regardless if being directed to a memory
region or not. Also remove the ALIGN() command before the .data section,
since this misleads the reader to think that the Location Counter is used
when assigning an address to the .data section, when it actually is not.

Fixes: 8a3e74446fe7 ("allow to build arm flat binaries")
Signed-off-by: Niklas Cassel <[email protected]>
20 months agoelf2flt: check for presence of libzstd
Greg Ungerer [Sun, 16 Apr 2023 22:36:33 +0000 (08:36 +1000)]
elf2flt: check for presence of libzstd

Binutils-2.40 introduced support for libzstd compressed bfd sections.
By default binutils configure will check for and use the system libzstd
library if it is present.

Now when compiling elf2flt using the bfd library from a
binutils-2.40 and a system present libzstd you will get link errors:

    /usr/bin/ld: ..//binutils-2.40/bfd/libbfd.a(compress.o): in function `decompress_contents':
    ../binutils-2.40/bfd/compress.c:517: undefined reference to `ZSTD_decompress'
    /usr/bin/ld: ../binutils-2.40/bfd/compress.c:519: undefined reference to `ZSTD_isError'
    /usr/bin/ld: ../binutils-2.40/bfd/libbfd.a(compress.o): in function `bfd_compress_section_contents':
    ../binutils-2.40/bfd/compress.c:656: undefined reference to `ZSTD_compress'
    /usr/bin/ld: ../binutils-2.40/bfd/compress.c:661: undefined reference to `ZSTD_isError'

Add a library check to the elf2flt configure for libzstd presence.
When present link using it.

There is no real problem when linking with -lzstd if compiling with
bfd libraries from older binutils, it just won't be needed. So there
is no need to make this check selective on binutils version.

Signed-off-by: Greg Ungerer <[email protected]>
20 months agoelf2flt: remove use of BFD_VMA_FMT
Greg Ungerer [Thu, 13 Apr 2023 12:58:20 +0000 (22:58 +1000)]
elf2flt: remove use of BFD_VMA_FMT

In binutils-2.40 the BFD_VMA_FMT definition used for printf style
formatting specifiers has been removed. For reference this was done in
commit b82817674f46 ("Don't use BFD_VMA_FMT in binutils") in the
binutils git development tree.

BFD_VMA_FMT is used in a number of places in the elf2flt code to output
bfd offsets, values and the like. So it is broken when using the bfd
code from binutils-2.40 and newer.

According to the binutils change PRIx64 (and friends) is used to replace
it, with appropriate casts to keep it clean for 32 and 64 bit platforms.
Change the elf2flt.c use of it in the same way to fix.

This does not change the output in any way in normal use. This fix can
be used on all versions of binutils (older and newer), there is no
need to only do this on 2.40 and newer.

Signed-off-by: Greg Ungerer <[email protected]>
21 months agoelf2flt: force ARM.exidx section into text
Greg Ungerer [Wed, 15 Mar 2023 13:45:48 +0000 (23:45 +1000)]
elf2flt: force ARM.exidx section into text

Fix problem with el2flt core dumping on binutils version 2.33.1 and
newer. Previous attempts at fixing this have had a list of subtle
problems causing further breakage.

The problem stems from the .ARM.exidx section being marked as load
readonly data, but the elf2flt.ld linker script puts it into the
flat text section. The elf2flt processing code expects all separate
ELF sections marked as "data" to be in the flat data section and
calculates sizing and memory based on that. (Note that traditional
readonly data is treated as text in the linker script, so it is not
affected here and is merged into the flat text section with no
problems).

The retaining of separate ELF sections outside of the flat text and
flat data flatmem sections proper is fragile. Fundamentally the
flat format only has the two stored sections - text and data. By far
the best appraoch is to explicilty put everything into those named
sections in the elf2flt.ld.

The .ARM.exidx section must be part of the flat text section - due
to the relocations that it carries. So move it into the text section
proper in the elf2flt.ld linker script.

Signed-off-by: Greg Ungerer <[email protected]>
21 months agoRevert "elf2flt: fix relocations for read-only data"
Greg Ungerer [Wed, 15 Mar 2023 13:01:00 +0000 (23:01 +1000)]
Revert "elf2flt: fix relocations for read-only data"

This reverts commit 73325b7f209e0f68887333385184af275531427d.

Although this fixed the simple problem case (elf2flt core dumping on
binutils newer than 2.33.1) it causes further breakage that required
further hacks to fix that resulted in more breakage.

Back all of these changes out and find a better way.

Note that this is actually a partial revert. It preserves the comment
fix in the original commit.

Signed-off-by: Greg Ungerer <[email protected]>
21 months agoRevert "elf2flt: fix for segfault on some ARM ELFs"
Greg Ungerer [Wed, 15 Mar 2023 12:53:23 +0000 (22:53 +1000)]
Revert "elf2flt: fix for segfault on some ARM ELFs"

This reverts commit ba379d08bb78c9300e84351c11080c26ddcc36b3.

This change breaks at least the m68k architecture support. It causes
overlapping text and data sections resulting in errors like this:

    ERROR: text=0x38f34 overlaps data=0x31a74 ?

The underlying cause here is that the .eh_frame section is marked
as readonly relocated data on m68k, resulting in it being treated
now as if it will be loaded into the flat text section. But it
is layed out in the linker script as part of the flat data section.

Note that this is actually a partial revert. It preserves the debug
printf fix in the original commit.

Signed-of-by: Greg Ungerer <[email protected]>
21 months agoelf2flt: handle binutils >= 2.34
Romain Naour [Wed, 5 Feb 2020 09:31:32 +0000 (10:31 +0100)]
elf2flt: handle binutils >= 2.34

The latest Binutils release (2.34) is not compatible with elf2flt due
to a change in bfd_section_* macros [1]. The issue has been reported
to the Binutils mailing list but Alan Modra recommend to bundle
libbfd library sources into each projects using it [2]. That's
because the API is not stable over the time without any backward
compatibility guaranties.

On the other hand, the elf2flt tools needs to support modified
version of binutils for specific arch/target [3].

Add two tests in the configure script to detect this API change
in order to support binutils < 2.34 and binutils >= 2.34.

Upstream status: [4]

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=fd3619828e94a24a92cddec42cbc0ab33352eeb4
[2] https://sourceware.org/ml/binutils/2020-02/msg00044.html
[3] https://github.com/uclinux-dev/elf2flt/issues/14
[4] https://github.com/uclinux-dev/elf2flt/pull/15

Signed-off-by: Romain Naour <[email protected]>
Two changes made to original patch:
. $binutils_include_dir used for binutils version check
. configure script regenerated (run autoconf)

Signed-off-by: Greg Ungerer <[email protected]>
23 months agoflthdr: have -P imply -p
Mike Frysinger [Sun, 29 Jan 2023 00:11:35 +0000 (19:11 -0500)]
flthdr: have -P imply -p

Trying to print relocs with only -P doesn't work as relocs are
shown only when -p is specified.  Rather than silently exit 0,
have -P imply -p.

Signed-off-by: Mike Frysinger <[email protected]>
3 years agoelf2flt.ld: add more documentation
Mike Frysinger [Fri, 20 Aug 2021 07:21:32 +0000 (03:21 -0400)]
elf2flt.ld: add more documentation

Help out people who like to dive into the source directly.

Signed-off-by: Mike Frysinger <[email protected]>
3 years agoelf2flt.ld: harmonize directive styles
Mike Frysinger [Fri, 20 Aug 2021 06:28:40 +0000 (02:28 -0400)]
elf2flt.ld: harmonize directive styles

We use "FOO:" style for "SINGLE_LINK:" and "TOR:" tags, but omit the
colon with "R_RODAT" and "W_RODAT" tags.  There's no reason for this
difference, and can be confusing to the casual reader.  Switch the
latter two over to use tags to be consistent.

Signed-off-by: Mike Frysinger <[email protected]>
3 years agoelf2flt: fix for segfault on some ARM ELFs
Mike Pilawa [Thu, 19 Aug 2021 08:04:25 +0000 (18:04 +1000)]
elf2flt: fix for segfault on some ARM ELFs

I believe a bug was introduced in commit [1], which was done to move the .ARM.exidx input section from .data to .text output section.  However, in doing so, the dynamic memory allocation for .text [elf2flt.c:~L1907: 'text = xmalloc(text_len);'] was not modified to allow for the additional .ARM.exidx section.  The result was that most of the time malloc() allocated enough extra memory [due to page-size or similar allocation boundaries] such that a small additional section went unnoticed.  However, in unlucky cases, the memory required for just the .text section fit almost perfectly within an allocation boundary, and the extra .ARM.exidx section exceeded the allocation, and thus produced a segfault when the memory was written.

The fix here modifies the calculation of 'text_len' in main() with logic similar to that of the original fix in [1] to output_relocs(), such that the correct amount of memory is allocated.  The code is also modified such that 'data_len' is also calculated correctly, and does not over-allocate memory.  This is necessary because the logic in main() is not a single grouping of if-elseif... priority logic as in output_relocs().

The change also attempts to be even more specific with input section selections for .text and .data output sections.
.text is only selected for input sections flagged as (SEC_CODE || (SEC_DATA && SEC_READONLY && SEC_RELOC))
.data is only selected for input sections flagged as (SEC_DATA && !(SEC_READONLY && SEC_RELOC))

The change appears to work correctly for previously segfault-causing ELF with these processed sections...
SEC_FLAGS:0x0000011f SEC_NAME:.text
SEC_FLAGS:0x0000012f SEC_NAME:.ARM.exidx
SEC_FLAGS:0x00000127 SEC_NAME:.data
SEC_FLAGS:0x00000123 SEC_NAME:.tm_clone_table
SEC_FLAGS:0x0000012b SEC_NAME:.eh_frame
SEC_FLAGS:0x00000001 SEC_NAME:.bss
SEC_FLAGS:0x00000100 SEC_NAME:.stack
SEC_FLAGS:0x01800108 SEC_NAME:.comment
SEC_FLAGS:0x00000108 SEC_NAME:.ARM.attributes
SEC_FLAGS:0x0000210c SEC_NAME:.debug_aranges
SEC_FLAGS:0x0000210c SEC_NAME:.debug_info
SEC_FLAGS:0x00002108 SEC_NAME:.debug_abbrev
SEC_FLAGS:0x0000210c SEC_NAME:.debug_line
SEC_FLAGS:0x0000210c SEC_NAME:.debug_frame
SEC_FLAGS:0x01802108 SEC_NAME:.debug_str
SEC_FLAGS:0x0000210c SEC_NAME:.debug_loc
SEC_FLAGS:0x00002108 SEC_NAME:.debug_ranges

It should also be pointed out that this commit may impact the regression noted in [2] and pull-request [3].
With this code change in place, elf2flt will put section .eh_frame with flags=0x12b in the .data output section.  If the flags for an .eh_frame section were 0x12f (same as .ARM.exidx), then it would end up in .text output section.

A few cosmetic changes are included as well.

[1] https://github.com/uclinux-dev/elf2flt/commit/73325b7f209e0f68887333385184af275531427d
[2] https://github.com/uclinux-dev/elf2flt/issues/12
[3] https://github.com/uclinux-dev/elf2flt/pull/16

Signed-off-by: Mike Pilawa <[email protected]>
3 years agold-elf2flt: handle NULL pointers with printf(%s) ourselves
Mike Frysinger [Wed, 18 Aug 2021 21:29:57 +0000 (17:29 -0400)]
ld-elf2flt: handle NULL pointers with printf(%s) ourselves

Since C & POSIX leave this as undefined behavior, gcc will warn about
it which breaks our -Werror builds.  Glibc handles this just fine (and
will print "(null)"), but since we support more platforms than just
glibc, add a helper macro to avoid the edge case.

Signed-off-by: Mike Frysinger <[email protected]>
3 years agotrim trailing whitespace
Mike Frysinger [Wed, 18 Aug 2021 19:30:06 +0000 (15:30 -0400)]
trim trailing whitespace

Signed-off-by: Mike Frysinger <[email protected]>
4 years agorename main development branch to main
Mike Frysinger [Wed, 13 Jan 2021 22:43:33 +0000 (17:43 -0500)]
rename main development branch to main

We'll keep "master" in the repo to help people migrate.

4 years agoconfigure: deprecate --disable-ld-elf2flt-binary
Mike Frysinger [Wed, 9 Sep 2020 09:21:51 +0000 (05:21 -0400)]
configure: deprecate --disable-ld-elf2flt-binary

We've been defaulting to the compiled linker for years now and no one
has complained.  Lets deprecate the old shell script so we don't have
to maintain two large tools doing the same thing.

Signed-off-by: Mike Frysinger <[email protected]>
4 years agoMerge pull request #17 from msteveb/microblaze-a-p-support
Mike Frysinger [Wed, 13 May 2020 13:40:42 +0000 (09:40 -0400)]
Merge pull request #17 from msteveb/microblaze-a-p-support

Update microblaze to work with -a -p

4 years agoDon't always update text in !pic_with_got case
Steve Bennett [Wed, 5 Feb 2020 01:12:36 +0000 (11:12 +1000)]
Don't always update text in !pic_with_got case

If the text fixup has already been done early, don't do the default
text update. Code can set update_text=0 to indicate this case.

Previously the fixup done for R_MICROBLAZE_64 was being stomped on by
the default text fixup.

Signed-off-by: Steve Bennett <[email protected]>
4 years agomicroblaze: properly handle relocations in resolved symbol mode
Steve Bennett [Tue, 28 Jan 2020 06:22:08 +0000 (16:22 +1000)]
microblaze: properly handle relocations in resolved symbol mode

The default is now to use -a -p, but microblaze currently has no support
for this.

Add support for the appropriate relocations and ignore
pc-relative and got(r20)-relative relocations.

Also:
- binfmt_flat can't support GOT data-relative relocations, so error out in that case
- Only output relocations debug if the relocation was actually created
- Tidy up the non-resolved symbol mode for microblaze

Signed-off-by: Steve Bennett <[email protected]>
4 years agotravis: dump config.log on configure failures
Mike Frysinger [Wed, 13 May 2020 11:25:07 +0000 (07:25 -0400)]
travis: dump config.log on configure failures

Signed-off-by: Mike Frysinger <[email protected]>
4 years agotravis: disable PIE in tests
Mike Frysinger [Wed, 13 May 2020 11:23:08 +0000 (07:23 -0400)]
travis: disable PIE in tests

Since all current prebuilt binutils libs are built w/out PIC/PIE,
disable PIE usage in tests.  Newer toolchains are defaulting this
to on which breaks us.

Signed-off-by: Mike Frysinger <[email protected]>
4 years agotests: run via github actions
Mike Frysinger [Wed, 13 May 2020 11:14:04 +0000 (07:14 -0400)]
tests: run via github actions

It integrates better than Travis.  Still run both for now to compare.

Signed-off-by: Mike Frysinger <[email protected]>
4 years agoelf2flt.c: add new relocation types for xtensa
Max Filippov [Fri, 8 May 2020 04:11:43 +0000 (21:11 -0700)]
elf2flt.c: add new relocation types for xtensa

Xtensa have added new relocation types R_XTENSA_[NP]DIFF{8,16,32} with
the same properties as the existing types R_XTENSA_DIFF{8,16,32}.
Add them to the list of ignored relocation types.

This fixes the following error when invoking elf2flt on xtensa binaries
built with the recent binutils:

  ERROR: reloc type R_XTENSA_PDIFF32 unsupported in this context

Reported-by: Romain Naour <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
5 years agoelf2flt.c: add support for SOURCE_DATE_EPOCH
Thomas Petazzoni [Fri, 27 Dec 2019 15:40:42 +0000 (16:40 +0100)]
elf2flt.c: add support for SOURCE_DATE_EPOCH

The bFLT header has a "build_date" field which contains the date/time
at which the bFLT file was created. Unfortunately, this breaks
reproducible builds as two identical builds done at different times
will produce different results.

For example, on a bFLT binary, diffoscope reports the following
change:

  00000000: 6246 4c54 0000 0004 0000 0045 0001 48d4  bFLT.......E..H.
  00000010: 0002 85a0 0002 fe50 0000 1000 0002 85a0  .......P........
 -00000020: 0000 0757 0000 0001 5e05 742e 0000 0000  ...W....^.t.....
 +00000020: 0000 0757 0000 0001 5e05 a5c2 0000 0000  ...W....^.......

In order to address this, this commit adds support for the
SOURCE_DATE_EPOCH environment variable, which is standardized by the
reproducible-builds.org group at
https://reproducible-builds.org/specs/source-date-epoch/.

We simply use the time from the SOURCE_DATE_EPOCH variable (which
contains the number of seconds since Epoch) when SOURCE_DATE_EPOCH is
available in the environment, and otherwise fallback to the existing
logic that takes the current time using time().

Signed-off-by: Thomas Petazzoni <[email protected]>
5 years agold-elf2flt: behave properly when called with a name different from TARGET_ALIAS
Thomas Petazzoni [Sun, 13 Aug 2017 14:03:20 +0000 (16:03 +0200)]
ld-elf2flt: behave properly when called with a name different from TARGET_ALIAS

ld-elf2flt currently handles two cases:

 1 It is called as the wrapper for <TARGET_ALIAS>-ld, generally
   installed in the bin/ directory of a toolchain.

 2 It is called as the wrapper for "ld", generally installed in the
   TARGET_ALIAS/bin/ directory of a toolchain.

Unfortunately, if for some reason it gets called using a FOOBAR-ld
name that is different from <TARGET_ALIAS>-ld, it assumes it is in
case (2), while it really is in case (1). Due to this, the path
mangling logic doesn't work, and it doesn't find ld.real.

This happens for example when the binary program in bin/ is named
arm-buildroot-uclinux-uclibcgnueabi-ld, but also has a simpler symlink
named arm-linux-ld. In this case,
arm-buildroot-uclinux-uclibcgnueabi-ld is recognized by ld-elf2flt as
containing TARGET_ALIAS, and therefore the proper logic to find
ld.real is applied. However, when arm-linux-ld is used, ld-elf2flt
doesn't find TARGET_ALIAS, and therefore assumes we're being called as
TARGET_ALIAS/bin/ld.. and searches for a program called ld.real in
bin/, which doesn't exist.

See:

$ ./output/host/bin/arm-buildroot-uclinux-uclibcgnueabi-ld
/home/thomas/buildroot/buildroot/output/host/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: no input files

$ ./output/host/bin/arm-linux-ld
arm-linux-ld (ld-elf2flt): error trying to exec '/home/thomas/buildroot/buildroot/output/host/bin/ld.real': execvp: No such file or directory

$ ./output/host/arm-buildroot-uclinux-uclibcgnueabi/bin/ld
/home/thomas/buildroot/buildroot/output/host/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: no input files

This commit fixes that by inverting the logic: if we're being called
as just "ld", then we assume it's the program in
TARGET_ALIAS/bin/. Otherwise, we're called through some variant of
TARGET-ld.

Signed-off-by: Thomas Petazzoni <[email protected]>
5 years agoelf2flt: fix relocations for read-only data
Greg Ungerer [Wed, 30 Oct 2019 06:08:19 +0000 (16:08 +1000)]
elf2flt: fix relocations for read-only data

Readonly data sections are mapped into the "text" section in the
elf2flt.ld linker script. The relocation generation code is not handling
that case properly though, and is actually mapping any data section type
into the "data" section of the target binary.

This problem case has been detected with elf2flt core dumping when used
with binutils-2.33.1 (on ARM architecture targets). See thread at:

  https://sourceware.org/ml/binutils/2019-10/msg00132.html

Signed-off-by: Greg Ungerer <[email protected]>
5 years agotravis: test against versions 2.27 through 2.31.1
Mike Frysinger [Sun, 17 Feb 2019 23:25:50 +0000 (18:25 -0500)]
travis: test against versions 2.27 through 2.31.1

Signed-off-by: Mike Frysinger <[email protected]>
5 years agoCreate more symlinks to BFD headers
Alexey Neyman [Sat, 29 Sep 2018 20:12:08 +0000 (13:12 -0700)]
Create more symlinks to BFD headers

... diagnostics.h and bfd_stdint.h, included by <bfd/bfd.h>.

Signed-off-by: Alexey Neyman <[email protected]>
5 years agoelf2flt: drop v850 reloc ifdefs
Mike Frysinger [Sun, 17 Feb 2019 21:14:33 +0000 (16:14 -0500)]
elf2flt: drop v850 reloc ifdefs

The binutils elf/v850.h header has used the elf/reloc-macros.h helpers
to create R_V850_xxx enums.  They haven't been defines for a long time.
Trying to use #ifdef checks on them doesn't work.

This means we require binutils-2.24+ now which was released in 2013.
We can see if anyone notices if we need to support older versions.

Signed-off-by: Mike Frysinger <[email protected]>
5 years agotravis: build all available versions of binutils
Mike Frysinger [Sun, 17 Feb 2019 20:41:18 +0000 (15:41 -0500)]
travis: build all available versions of binutils

This helps make sure we work across a variety of versions.

5 years agoCheck `output_elf' for being NULL
Alexey Neyman [Fri, 15 Feb 2019 04:12:34 +0000 (20:12 -0800)]
Check `output_elf' for being NULL

... before passing it to unlink(). GCC8.2 detects that one of the
branches in do_final_link() does not initialize it from its original
value, NULL.

Signed-off-by: Alexey Neyman <[email protected]>
7 years agoMerge pull request #7 from stilor/fix-cygwin-build-2
Mike Frysinger [Mon, 20 Mar 2017 04:04:18 +0000 (21:04 -0700)]
Merge pull request #7 from stilor/fix-cygwin-build-2

Fix cygwin and macos builds

7 years agoSymlink required binutils/BFD headers to local dir
Alexey Neyman [Mon, 27 Feb 2017 09:20:10 +0000 (01:20 -0800)]
Symlink required binutils/BFD headers to local dir

... to minimize the chance of clashes with system headers.

Also, remove the -lcygwin from Makefile.in: this breaks canadian
build on cygwin, as it tries to pass -lcygwin into non-Cygwin host
CC. This chunk pre-dates the addition of -lc into configure.ac and
passing -lc should be sufficient (it works for me).

Signed-off-by: Alexey Neyman <[email protected]>
7 years agoelf2flt: clean up elf headers dependencies
Mike Frysinger [Wed, 1 Mar 2017 06:56:29 +0000 (23:56 -0700)]
elf2flt: clean up elf headers dependencies

The only reason we included cygwin-elf.h & elf.h was for the various
target reloc defines.  However, since these are all provided by the
bfd library which we already include, we can switch to using that for
every target.

Now we don't have any dep on the host's ELF headers (either existing,
or being up-to-date).

7 years agotravis: drop unused TARGETS variable
Mike Frysinger [Wed, 1 Mar 2017 06:55:49 +0000 (23:55 -0700)]
travis: drop unused TARGETS variable

7 years agotravis: update to binutils-2.26.1
Mike Frysinger [Wed, 1 Mar 2017 06:45:04 +0000 (23:45 -0700)]
travis: update to binutils-2.26.1

7 years agocheck for libz first
Alexey Neyman [Sat, 4 Feb 2017 06:01:48 +0000 (22:01 -0800)]
check for libz first

If building statically, linking libz before libbfd results in unresolved
symbols (compress/compressBound in libbfd.a).

Signed-off-by: Alexey Neyman <[email protected]>
8 years agoelf2flt: fix unused warning for e1/bfin targets
Mike Frysinger [Mon, 12 Dec 2016 05:35:04 +0000 (00:35 -0500)]
elf2flt: fix unused warning for e1/bfin targets

The one call site for this func is inside of an e1/bfin ifdef check,
so add the same logic to the definition to fix a build error:
elf2flt.c:212:1: error: â€˜get_symbol_offset’ defined but not used [-Werror=unused-function]

Signed-off-by: Mike Frysinger <[email protected]>
8 years agoelf2flt: use fatal() instead of printf();exit(1)
Mike Frysinger [Tue, 13 Sep 2016 07:03:46 +0000 (03:03 -0400)]
elf2flt: use fatal() instead of printf();exit(1)

We've got a help function specifically for showing fatal error
messages and then exiting, so use it.

Signed-off-by: Mike Frysinger <[email protected]>
8 years agoelf2flt: mark all funcs/vars static
Mike Frysinger [Tue, 13 Sep 2016 06:56:57 +0000 (02:56 -0400)]
elf2flt: mark all funcs/vars static

Signed-off-by: Mike Frysinger <[email protected]>
8 years agoflthdr: drop unused mkstemp define
Mike Frysinger [Tue, 13 Sep 2016 06:46:35 +0000 (02:46 -0400)]
flthdr: drop unused mkstemp define

This file stopped using mkstemp a while back, so drop this hack
that is no longer needed.

Signed-off-by: Mike Frysinger <[email protected]>
8 years agoMerge pull request #3 from KirillSmirnov/uninitialized-var
Mike Frysinger [Tue, 13 Sep 2016 06:37:14 +0000 (02:37 -0400)]
Merge pull request #3 from KirillSmirnov/uninitialized-var

My gcc is 5.4.0, target is m68k, binutils 2.26.

elf2flt.c: In function 'output_relocs':
elf2flt.c:1604:5: error: 'sym_reloc_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
printf(" RELOC[%d]: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "

8 years agoFix an uninitialized variable.
Kirill Smirnov [Mon, 12 Sep 2016 10:37:26 +0000 (13:37 +0300)]
Fix an uninitialized variable.

Signed-off-by: Kirill Smirnov <[email protected]>
8 years agoelf2flt: fix relocation support for R_ARM_TARGET types
Greg Ungerer [Fri, 19 Aug 2016 13:49:51 +0000 (23:49 +1000)]
elf2flt: fix relocation support for R_ARM_TARGET types

R_ARM_TARGET1 (and I think R_ARM_TARGET2) relocation types should be
treated in the same way as R_ARM_ABS32. Fix them to write out the addend
to the flat binary in network byte order.

Signed-off-by: Greg Ungerer <[email protected]>
8 years agoelf2flt: support ARM R_ARM_V4BX relocation type
Greg Ungerer [Thu, 18 Aug 2016 06:36:14 +0000 (16:36 +1000)]
elf2flt: support ARM R_ARM_V4BX relocation type

Trivially add support for the ARM R_ARM_V4BX relocation type.

Signed-off-by: Greg Ungerer <[email protected]>
8 years agoMerge pull request #2 from mcoquelin-stm32/master
Mike Frysinger [Wed, 20 Apr 2016 15:13:56 +0000 (11:13 -0400)]
Merge pull request #2 from mcoquelin-stm32/master

Fix buffer overflow in output_relocs()

8 years agoFix buffer overflow in output_relocs()
Maxime Coquelin [Wed, 20 Apr 2016 08:00:39 +0000 (10:00 +0200)]
Fix buffer overflow in output_relocs()

This crash is seen when trying to build uclibc for a ARMV7-M platform on a
x86-64 host:

make[1]: Entering directory `<...>/build/uclibc-1.0.14'
  CC utils/getconf
*** buffer overflow detected ***: <...>/bin/elf2flt terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x2ad3be5f738f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x2ad3be68ec9c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109b60)[0x2ad3be68db60]
/lib/x86_64-linux-gnu/libc.so.6(+0x109069)[0x2ad3be68d069]
/lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0xbc)[0x2ad3be5ff70c]
/lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0xaef)[0x2ad3be5ce7df]
/lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x84)[0x2ad3be68d0f4]
/lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x2ad3be68d04d]
 <...>/bin/elf2flt[0x403cda]
 <...>/bin/elf2flt[0x4030a4]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x2ad3be5a5ec5]
 <...>/bin/elf2flt[0x403642]
...

In output_relocs, we do "sprintf(&addstr[0], "+0x%lx", ...)", with addrstr
being a 16 bytes array.

On 64bits hosts, in the unlikely case the value overflows 32bits, the buffer
may overflow.

Indeed, the maximum theorical size is 20 bytes (16 bytes for the value + 3
bytes for "+0x" + the end of string marker).

The reason the value overflows 32bits is yet to be understood, as the ARMV7-M
is 32bits architecture, but this patch first ensure the sprintf call is robust
enough.

Signed-off-by: Maxime Coquelin <[email protected]>
8 years agoallow to build arm flat binaries
Waldemar Brodkorb [Mon, 14 Mar 2016 05:01:58 +0000 (06:01 +0100)]
allow to build arm flat binaries

Add patchset from ptxdist which is required to produce working
ARM flat binaries. Tested with busybox on Kinetis K70.

Signed-off-by: Waldemar Brodkorb <[email protected]>
Tested-by: Thomas Petazzoni <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
9 years agoREADME: update file listing
Mike Frysinger [Thu, 14 Jan 2016 13:15:25 +0000 (08:15 -0500)]
README: update file listing

9 years agotravis: add xtensa to test list
Mike Frysinger [Thu, 14 Jan 2016 13:13:16 +0000 (08:13 -0500)]
travis: add xtensa to test list

9 years agoMerge pull request #1 from jserv/master
Mike Frysinger [Thu, 14 Jan 2016 13:04:17 +0000 (08:04 -0500)]
Merge pull request #1 from jserv/master

Use new FSF address in GPL notices

9 years agoUse new FSF address in GPL notices
Jim Huang [Thu, 14 Jan 2016 09:44:43 +0000 (17:44 +0800)]
Use new FSF address in GPL notices

Correct the address of Free Software Foundation via
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

9 years agoAdd xtensa support
Waldemar Brodkorb [Wed, 30 Dec 2015 23:55:48 +0000 (00:55 +0100)]
Add xtensa support

This is forward ported version of patch from 2006' elf2flt by
Oskar Schirmer <[email protected]>.

Signed-off-by: Max Filippov <[email protected]>
Signed-off-by: Waldemar Brodkorb <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
9 years agoREADME.md: update email addresses
Greg Ungerer [Fri, 8 Jan 2016 01:36:17 +0000 (11:36 +1000)]
README.md: update email addresses

The @snapgear.com email addresses have not worked for years. Replace
them with up to data contact info.

Signed-off-by: Greg Ungerer <[email protected]>
9 years agoR_H8_DIR24 fix
Yoshinori Sato [Wed, 30 Dec 2015 23:55:47 +0000 (00:55 +0100)]
R_H8_DIR24 fix

R_H8_DIR24A8 / R_H8_DIR24R8 keep all byte.

Signed-off-by: Yoshinori Sato <[email protected]>
Signed-off-by: Waldemar Brodkorb <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
9 years agoH8/300 relocation fix
Yoshinori Sato [Wed, 30 Dec 2015 23:55:46 +0000 (00:55 +0100)]
H8/300 relocation fix

Add new relocation R_H8_DISP32A16.
hi-byte clear on R_H8_DIR32 R_H8_DIR24A8 R_H8_DIR24R8 R_H8_DIR32A16 R_H8_DISP32A16

Signed-off-by: Yoshinori Sato <[email protected]>
Signed-off-by: Waldemar Brodkorb <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
9 years agoconfigure: regenerate configure script
Greg Ungerer [Thu, 7 Jan 2016 11:48:16 +0000 (21:48 +1000)]
configure: regenerate configure script

Recent change to configure.ac to remove prefix symbol for h8300 requires
regeneration of the local configure script.

Signed-off-by: Greg Ungerer <[email protected]>
9 years agorecent binutils for h8/300 no longer use prefix
Waldemar Brodkorb [Wed, 30 Dec 2015 23:55:44 +0000 (00:55 +0100)]
recent binutils for h8/300 no longer use prefix

Remove SYMBOL_PREFIX for h8/300.

Signed-off-by: Waldemar Brodkorb <[email protected]>
Signed-off-by: Yoshinori Sato <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
9 years agoconfigure: regenerate configure script
Greg Ungerer [Wed, 6 Jan 2016 01:20:10 +0000 (11:20 +1000)]
configure: regenerate configure script

Recent changes to configure.ac to add a dlopen check require a regeneration
of the local configure script.

Signed-off-by: Greg Ungerer <[email protected]>
9 years agodlopen is used by newer binutils, so check for it
Waldemar Brodkorb [Tue, 5 Jan 2016 18:13:12 +0000 (19:13 +0100)]
dlopen is used by newer binutils, so check for it

Add a check for dlopen to configure.ac

Signed-off-by: Waldemar Brodkorb <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
9 years agoenable travis builds w/github
Mike Frysinger [Fri, 18 Dec 2015 02:55:28 +0000 (21:55 -0500)]
enable travis builds w/github

9 years agoREADME: use markdown
Mike Frysinger [Thu, 24 Dec 2015 06:25:31 +0000 (01:25 -0500)]
README: use markdown

This makes the file render nicely in github while still being readable.

9 years agostart a testsuite
Mike Frysinger [Thu, 24 Dec 2015 05:02:05 +0000 (00:02 -0500)]
start a testsuite

9 years agostandardize usage behavior
Mike Frysinger [Thu, 24 Dec 2015 04:38:24 +0000 (23:38 -0500)]
standardize usage behavior

Make sure the tools respect the -h (help) option, and exit 0 & use stdout
when called that way.  For all other cases, exit 1 & use stderr.

9 years agoflthdr: constify a few strings
Mike Frysinger [Thu, 24 Dec 2015 04:31:42 +0000 (23:31 -0500)]
flthdr: constify a few strings

9 years agoflthdr: fix print output w/no flags
Mike Frysinger [Thu, 24 Dec 2015 04:30:31 +0000 (23:30 -0500)]
flthdr: fix print output w/no flags

If the file has no flags, make sure we still include the closing paren
and newline in the output.

9 years agoconfigure: build with -Werror by default
Mike Frysinger [Fri, 18 Dec 2015 05:07:21 +0000 (00:07 -0500)]
configure: build with -Werror by default

People can pass --disable-werror to turn this off.  But this will help
keep the main development builds clean with new code coming in.

9 years agoelf2flt/ld-elf2flt: clean up build time warnings
Mike Frysinger [Fri, 18 Dec 2015 05:06:26 +0000 (00:06 -0500)]
elf2flt/ld-elf2flt: clean up build time warnings

9 years agoelf2flt: v850: fix build w/newer binutils
Mike Frysinger [Fri, 18 Dec 2015 04:59:29 +0000 (23:59 -0500)]
elf2flt: v850: fix build w/newer binutils

We need to include the v850 header directly for the right relocs,
and handle the renamed abs32 reloc.

9 years agoinstall: add DESTDIR support
Mike Frysinger [Fri, 18 Dec 2015 02:51:49 +0000 (21:51 -0500)]
install: add DESTDIR support

9 years agogitignore: update files
Mike Frysinger [Fri, 18 Dec 2015 02:43:45 +0000 (21:43 -0500)]
gitignore: update files

9 years agoautotools: regenerate
Mike Frysinger [Fri, 18 Dec 2015 02:40:41 +0000 (21:40 -0500)]
autotools: regenerate

9 years agoconfigure: rename input newer versions
Mike Frysinger [Fri, 18 Dec 2015 02:39:35 +0000 (21:39 -0500)]
configure: rename input newer versions

Newer autotools wants .ac suffix and warns/errors when using .in.

12 years agoFrom: Larry Baker <[email protected]>
Greg Ungerer [Thu, 4 Oct 2012 02:32:38 +0000 (02:32 +0000)]
From: Larry Baker <[email protected]>

The _stack_start symbol needs to be in the same flatmem memory region
as text/data/bss, otherwise it will not end up with the correct address.
Direct the section into the flatmem region.

Signed-of-by: Greg Ungerer <[email protected]>
13 years agoThe GNU linker uses -v as a shortcut to --version, not --verbose. So atm,
David McCullough [Mon, 4 Apr 2011 01:17:17 +0000 (01:17 +0000)]
The GNU linker uses -v as a shortcut to --version, not --verbose.  So atm,
if you run `ld -v` to get the linker version, ld-elf2flt throws out a lot
of verbose debugging information.  So drop the -v checking in ld-elf2flt
to keep from breaking systems that parse the linker version.

Signed-off-by: Mike Frysinger <[email protected]>
13 years agothe attached patch is needed for the recent elf2flt
David McCullough [Tue, 15 Feb 2011 23:22:26 +0000 (23:22 +0000)]
the attached patch is needed for the recent elf2flt
on MinGW builds. The stat() cannot cope with directories
ending with the directory separator.

Regards
Stanislav Meduna <[email protected]>

14 years agoThe .note.ABI-tag section exists to indicate to other projects (like gdb
David McCullough [Thu, 16 Dec 2010 01:37:41 +0000 (01:37 +0000)]
The .note.ABI-tag section exists to indicate to other projects (like gdb
or library loaders) information about the target OS.  It doesn't actually
contain anything that is used at runtime.  So while the current linker
script gathers this into the .data section, the final FLAT doesn't include
anything from it.  But tools expect to find a dedicated section in ELFs
which the current section merge prevents.^M

So give .note.ABI-tag its own output section so gdb can locate and use it.
This shouldn't change the FLAT files produced in any way.

Signed-off-by: Mike Frysinger <[email protected]>
14 years agoWhen we converted ld-elf2flt from the shell script to C, one small nuance
David McCullough [Tue, 17 Aug 2010 04:25:26 +0000 (04:25 +0000)]
When we converted ld-elf2flt from the shell script to C, one small nuance
was missed: argv[0] contains the full path only when invoked with the full
path.  This is not the same behavior for shell scripts as $0 is always the
full path to the script in question.  Most of the time this isn't an issue
as gcc will invoke all of its tools (like the linker) with a full relative
path to itself.  However, if we attempt to invoke the linker directly, we
can see misbehavior such as:
bfin-uclinux-ld.real: cannot open linker script file ./../lib/elf2flt.ld:
No such file or directory

So, to fix this, we lean on more libiberty functions.  Specifically, the
make_relative_prefix() function.  This function locates a full argv[0] by
scanning $PATH to see where it was invoked.  This might sound a little
dodgy, but this is fundamental to how gcc and binutils implement support
for their runtime relocation, so it can't break ld-elf2flt without first
breaking every one else ;).

In the fall out of this fix, we can cull a bunch of local code that does
custom path parsing.  So not only do we get to fix an annoying bug, we get
to shrink code in the process.

Signed-off-by: Steve Kilbane <[email protected]>
Signed-off-by: Mike Frysinger <[email protected]>
14 years agoThe current code misses checking a few args in order to determine the
David McCullough [Tue, 22 Jun 2010 06:12:47 +0000 (06:12 +0000)]
The current code misses checking a few args in order to determine the
default "print" mode (ktrace/l1stack/...).  Rather than update a list
that people easily forget, rework the code to generically detect that
no arguments have been specified.

Signed-off-by: Mike Frysinger <[email protected]>
14 years agoThe sed debug showed incorrect syntax for deletions, and the program exec
David McCullough [Tue, 11 May 2010 12:27:11 +0000 (12:27 +0000)]
The sed debug showed incorrect syntax for deletions, and the program exec
debug missed output redirection.

Signed-off-by: Mike Frysinger <[email protected]>
14 years agoHere is a patch to fix a ``misunderstanding'' between the kernel (bflt
Greg Ungerer [Tue, 9 Mar 2010 06:19:11 +0000 (06:19 +0000)]
Here is a patch to fix a ``misunderstanding'' between the kernel (bflt
loader) and GDB; noticed on m68k / coldfire uClinux.

Lacking specific directives in the linker script, the linker *may* decide
to put .text and .data into the same segment:

     Section to Segment mapping:
      Segment Sections...
       00     .text .data .eh_frame_hdr .eh_frame .bss
       01     .eh_frame_hdr

The bflt loader in the kernel will, however, add a small extra data table
just before .data's content (cf. handling of MAX_SHARED_LIBS in
binfmt_flat.c:load_flat_file).

Now, if .text and .data are in the same segment, directly following each
other in the binary file, but have that extra data table added in the
run-time memory layout, GDB will get very confused when trying to access
items in the now-moved .data section.  Without any kernel (loader) / GDB
changes, the solution is to tell the linker to always put .text and .data
into separate segments, which GDB will handle gracefully then.

     Section to Segment mapping:
      Segment Sections...
       00     .text
       01     .data .eh_frame_hdr .eh_frame .bss

Tested on m68k-uclinux (where the problem occurred) and arm-uclinuxeabi
(no regressions).

2010-02-27  Thomas Schwinge  <[email protected]>

14 years agouse AS_HELP_STRING for all configure options
David McCullough [Wed, 3 Feb 2010 22:34:49 +0000 (22:34 +0000)]
use AS_HELP_STRING for all configure options
Signed-off-by: Mike Frysinger <[email protected]>
14 years agoThis is needed for Blackfin FLAT's to be processed properly, and apparently
David McCullough [Wed, 3 Feb 2010 22:32:46 +0000 (22:32 +0000)]
This is needed for Blackfin FLAT's to be processed properly, and apparently
some other people have seen similar behavior.

http://lists.uclibc.org/pipermail/uclibc/2009-April/042363.html
http://thread.gmane.org/gmane.linux.hardware.blackfin.toolchain.devel/1121

Signed-off-by: Bernd Schmidt <[email protected]>
Signed-off-by: Mike Frysinger <[email protected]>
14 years agoMake varargs debug macros GCC-2.x compatible.
David McCullough [Fri, 22 Jan 2010 01:54:20 +0000 (01:54 +0000)]
Make varargs debug macros GCC-2.x compatible.
Signed-off-by: Mike Frysinger <[email protected]>
15 years ago[PATCH] add Blackfin to the README
Greg Ungerer [Wed, 20 Jan 2010 02:28:18 +0000 (02:28 +0000)]
[PATCH] add Blackfin to the README

Signed-off-by: Mike Frysinger <[email protected]>
15 years agofix option order when invoking children
David McCullough [Mon, 9 Nov 2009 23:59:26 +0000 (23:59 +0000)]
fix option order when invoking children

Poor getopt() implementations as found in many BSD/Darwin systems will
stop processing options after a non-option is encountered.  That means
ld-elf2flt has to be careful to not stick options after non-options when
executing sub children.  In a default setup, it will invoke `elf2flt` with
the output followed by the -a option which subsequently fails:
elf2flt: Can't open '-a': No such file or directory

15 years agofix elf2flt dep generation in out-of-tree builds
David McCullough [Sun, 30 Aug 2009 11:43:03 +0000 (11:43 +0000)]
fix elf2flt dep generation in out-of-tree builds
Signed-off-by: Mike Frysinger <[email protected]>
15 years agothe "all" target should not be depending on "ld-elf2flt"
David McCullough [Tue, 14 Jul 2009 23:00:33 +0000 (23:00 +0000)]
the "all" target should not be depending on "ld-elf2flt"
anymore as this is handled through the PROG vars.  it isnt a problem
for Linux systems, but when EXEEXT is set, things go boom.

Mike Frysinger <[email protected]>

15 years agothe Makefile.in still refers to elf2flt.sh.in:
David McCullough [Tue, 14 Jul 2009 14:49:14 +0000 (14:49 +0000)]
the Makefile.in still refers to elf2flt.sh.in:
ld-elf2flt.sh: $(srcdir)/ld-elf2flt.sh.in

that should be:
ld-elf2flt.sh: $(srcdir)/ld-elf2flt.in

the shell script is generated without +x bits, but that is fixed
during the install step ... so probably not a real big problem

Mike Frysinger <[email protected]>

15 years agoDue to shell portability issues (which is to say shell scripts are not
David McCullough [Sun, 12 Jul 2009 23:28:58 +0000 (23:28 +0000)]
Due to shell portability issues (which is to say shell scripts are not
portable -- think Windows), convert elf2flt to C code.

I've updated this code base to the latest elf2flt tree and actually done
some basic tests -- building the three Blackfin tuples (ELF, FLAT, FDPIC)
and running programs on my Blackfin boards.  This process found errors in
the original implementation as well as some of the cleanups I did.

Signed-off-by: Nathan Sidwell <[email protected]>
Signed-off-by: Mike Frysinger <[email protected]>
15 years agohandle more strip/verbose options.
David McCullough [Tue, 7 Jul 2009 05:39:06 +0000 (05:39 +0000)]
handle more strip/verbose options.
Signed-off-by: Mike Frysinger <[email protected]>
15 years agoUnify the duplicated windows and other system fallback logic in stubs.h
David McCullough [Tue, 7 Jul 2009 04:39:42 +0000 (04:39 +0000)]
Unify the duplicated windows and other system fallback logic in stubs.h
and add some fatal() helper functions to standardize the error output when
falling over.  This way we don't end up with obscure error messages with
no idea what util they are coming from.

Signed-off-by: Mike Frysinger <[email protected]>
15 years agogenerate dependency info automatically
David McCullough [Tue, 7 Jul 2009 00:51:21 +0000 (00:51 +0000)]
generate dependency info automatically
Signed-off-by: Mike Frysinger <[email protected]>
15 years agoThis cleans up the Makefile handling of the different compiler flags such
David McCullough [Tue, 7 Jul 2009 00:49:11 +0000 (00:49 +0000)]
This cleans up the Makefile handling of the different compiler flags such
that it uses standard names across the board as well as unifies the link
method.

Signed-off-by: Mike Frysinger <[email protected]>
15 years agoadd more common files to gitignore
David McCullough [Tue, 7 Jul 2009 00:46:52 +0000 (00:46 +0000)]
add more common files to gitignore
Signed-off-by: Mike Frysinger <[email protected]>
15 years agothe flat.h header uses things like uint32_t but does not pull in the
David McCullough [Mon, 6 Jul 2009 04:45:16 +0000 (04:45 +0000)]
the flat.h header uses things like uint32_t but does not pull in the
appropriate stdint.h header

Mike Frysinger <[email protected]>

15 years agoWe renamed all the Blackfin relocs in the toolchain to match other ports
David McCullough [Thu, 4 Jun 2009 23:16:34 +0000 (23:16 +0000)]
We renamed all the Blackfin relocs in the toolchain to match other ports
(all caps and a R_BFIN_ prefix), so update elf2flt accordingly.

Signed-off-by: Mike Frysinger <[email protected]>
15 years agoRather than putting the `rm` at the end of the script before the normal
David McCullough [Tue, 2 Jun 2009 00:09:46 +0000 (00:09 +0000)]
Rather than putting the `rm` at the end of the script before the normal
exit point, create a trap to automatically delete the script when exiting.
This way the linker script gets cleaned up whenever there is an error as
well.  Otherwise every link invocation that ends in a failure could leave
behind crap.  On my system, i found almost 2 million of these suckers in
my /tmp dir.

Signed-off-by: Mike Frysinger <[email protected]>
15 years agoWhen the relocs are larger than 16bits, incorrect values are written when
David McCullough [Sun, 24 May 2009 23:33:48 +0000 (23:33 +0000)]
When the relocs are larger than 16bits, incorrect values are written when
the .H/.L loading are reversed.  Normally this wouldn't happen because the
gcc compiler always outputs in the same order (first hi, then lo).

Signed-off-by: Jie Zhang <[email protected]>
Signed-off-by: Mike Frysinger <[email protected]>
This page took 0.081085 seconds and 4 git commands to generate.