Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
The ld lexer converts strings to integers without overflow checking,
so I don't think there is any problem in truncating an integer that
exceeds the size of a bfd_vma rather than using (bfd_vma) -1.
PR 31120
* ldlex.l: Don't use bfd_scan_vma for integer conversion, use
strtoull.
|
|
Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:
1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
author I haven't committed, 'Kalray SA.', to cover gas testsuite
files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.
|
|
PR 27565
* ldlex.l: Add REVERSE.
* ldgram.y: Allow REVERSE to be used wherever a sorting command can be used.
* ld.h (struct wildcard_spec): Add 'reversed' field.
* ldlang.h (lang_wild_statement_struct): Add 'filenames_reversed' field.
* ldlang.c (compare_sections): Add reversed parameter. (wild_sort): Reverse the comparison if requested. (print_wild_statement): Handle the reversed field.
* ld.texi: Document the new feature.
* NEWS: Mention the new feature.
* testsuite/ld-scripts/sort-file-reversed-1.d: New test driver.
* testsuite/ld-scripts/sort-file-reversed-1.t: New test source.
* testsuite/ld-scripts/sort-file-reversed-2.t: New test source.
* testsuite/ld-scripts/sort-file-reversed-2.d: New test driver.
* testsuite/ld-scripts/sort-sections-reversed-1.d: New test driver.
* testsuite/ld-scripts/sort-sections-reversed-1.t: New test source.
* testsuite/ld-scripts/sort-sections-reversed-2.t: New test source.
* testsuite/ld-scripts/sort-sections-reversed-2.d: New test driver.
* testsuite/ld-scripts/sort-sections-reversed-3.d: New test driver.
* testsuite/ld-scripts/sort-sections-reversed-3.t: New test source.
|
|
PR 30951
* ldlex.l (yy_input): Check for YY_CURRENT_BUFFER being NULL.
|
|
This reverts commit 675b9d612cc59446e84e2c6d89b45500cb603a8d.
See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
|
|
|
|
this requires also changes in ldgram.y and ldexp.c, unlike
accepting '^' only. But let's do this anyway, if only for
symmetry.
|
|
so that the (existing) code in parser and expression evaluator
actually get to see it and handle it as XOR. Also adjust docu
to match what's there.
|
|
Having been irritated by seeing bfd/elf{32,64}-aarch64.c to be re-
generated in x86-only builds, I came across 769a27ade588 ("Re: bfd
BLD-POTFILES.in dependencies"). I think this went slightly too far, as
outside of maintainer mode dependencies will cause the subset of files
to be (re-)generated which are actually needed for the build.
Generating them all is only needed when wanting to update certain files
under bfd/po/, i.e. in maintainer mode.
In the course of looking around in an attempt to try to understand how
things are meant to work, I further noticed that ld has got things
slightly wrong too: BLD-POTFILES.in depending on $(BLD_POTFILES) isn't
quite right (the output doesn't change when any of the enumerated files
changes; it's the mere presence which matters); like in bfd it looks
like we would better extend BUILT_SOURCES accordingly.
Furthermore it became apparent that ld fails to enumerate the .c files
generated from the .l and .y ones. While in their absence it was benign
whether translatable strings in the source files were actually marked as
such, this now becomes relevant. Mark respective strings at the same
time, but skipping ones which look to be of interest for debugging
purposes only (e.g. such used by printf() enclosed in #ifdef TRACE).
|
|
.comment section.
PR 30187
* NEWS: Mention the new feature. * ld.texi: Document the new feature. * ldgram.y: Handle LINKER_VERSION token. * ldlang.c (lang_add_version): New function. (enable_linker_version): New global variable. * ldlang.h (land_add_version): Prototype. (enable_linker_version): Export. * ldlex.h (OPTION_ENABLE_LINKER_VERSION): Define. (OPTION_DISABLE_LINKER_VERSION): Define. * ldlex.l (LINKER_VERSION): Add token. * lexsup.c (ld_options): Add --enable-linker-version and --disable-linker-version. (parse_args): Handle the new options. * scripttempl/arclinux.sc: Remove stabs and comment sections and replace with inclusion of misc-sections.sc * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/ft32.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/script.exp: Run new tests. * scripttempl/misc-sections.sc: New file. * testsuite/ld-scripts/ld-version-2.d: New file. * testsuite/ld-scripts/ld-version.d: New file. * testsuite/ld-scripts/ld-version.t: New file.
|
|
Revert "Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant."
This reverts commit adbe951fc95943016325af08d677f18e8c177ac1.
Revert "ld test asciz and ascii fails"
This reverts the ascii.d part of commit 5f497256bee624f0fa470949aa41534093bc5b25.
Revert "Add support for the ASCII directive inside linker scripts."
This mostly reverts commit 9fe129a4105bb59398f73ce96938a94f19265b79
leaving the asciz.d and asciz.t changes in place.
|
|
This is a hopefully temporary reversion of new ld features for
embedded processors by Ulf Samuelsson, plus some followup patches.
Squashed together from the following:
Revert "lddigest 32-bit support and gcc-4 compile errors"
This reverts commit d7ee19be87110a8f5342cec6e323d83d01c641d1.
Revert "ld: Use correct types for crc64 calculations"
This reverts commit 9a534b9f8e3d0f3cdb5a20f19ff165693fbb84d2.
Revert "Re: DIGEST: testsuite"
This reverts commit c8e85484d8a0fe9f7b88e00a6b9ae63bcb53ba32.
Revert "Regen potfiles"
This reverts commit 4d98c966f8bf305ab25badd34cb295631873cf7c.
Revert "DIGEST: Makefile.*"
This reverts commit 78ef6ab03f56ce83a606d974bb8a9f34b5d6e0b7.
Revert "DIGEST: calculation"
This reverts commit 5243990191e683d5066d3dd622c76deaba0bf15c.
Revert "DIGEST: ldlang.*: add timestamp"
This reverts commit bd9466d4aa277a469a9d8b12f0a6e6fa51678e36.
Revert "DIGEST: ldmain.c"
This reverts commit c8f8653fa7eeb3dc0769ac23039eadb5c5f09dff.
Revert "DIGEST: ldgram.y"
This reverts commit d73c01be2669e9c5267fab669a269f95a32048c9.
Revert "DIGEST: ldlex.l"
This reverts commit 48b5163a9dd5759cc87171331bbd6e902c547b5a.
Revert "DIGEST: testsuite"
This reverts commit a4135d1a4886400ea29af2da782dd8dd40ccad23.
Revert "DIGEST: Documentation"
This reverts commit 3ec28966c3e4c63704212778f96c517cbf2e0090.
Revert "DIGEST: NEWS"
This reverts commit 099bf2927d446424e8585a60cf4ce63209999aa2.
Revert "DIGEST: LICENSING"
This reverts commit 5c8a0c6654fb55926985edf3b360b62d4f20691d.
|
|
Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
|
|
* ldlex.l: Add ASCII token.
* ldgram.y: Add parsing of the ASCII command.
* ldlang.c (lang_add_string): Add maximum size parameter. Move escape character handling code into separate function.
* ldlang.h (lang_add_string): Update prototype.
* NEWS: Mention the new feature.
* ld.texi (Output Section Data): Document the new directives.
* testsuite/ld-scripts/asciz.t: Adjust to work on more architectures and to test more aspects of the ASCIZ directive.
* testsuite/ld-scripts/asciz.d: Adjust to match the changes to the test linker script.
* testsuite/ld-scripts/ascii.d: New test driver.
* testsuite/ld-scripts/ascii.s: New test assembler source.
* testsuite/ld-scripts/ascii.t: New test script.
* testsuite/ld-scripts/script.exp: Run the new test.
|
|
Adds a new directive to the linker script syntax: ASCIZ.
This inserts a zero-terminated string into the output at the place where it is used.
|
|
The newer update-copyright.py fixes file encoding too, removing cr/lf
on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and
embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
|
|
bfd/
PR ld/28841
* bfd-in2.h (struct bfd_section): Add type.
(discarded_section): Add field.
* elf.c (elf_fake_sections): Handle bfd_section::type.
* section.c (BFD_FAKE_SECTION): Add field.
* mri.c (mri_draw_tree): Update function call.
ld/
PR ld/28841
* ld.texi: Document new output section type.
* ldlex.l: Add new token TYPE.
* ldgram.y: Handle TYPE=exp.
* ldlang.h: Add type_section to list of section types.
* ldlang.c (lang_add_section): Handle type_section.
(map_input_to_output_sections): Handle type_section.
* testsuite/ld-scripts/output-section-types.t: Add tests.
* testsuite/ld-scripts/output-section-types.d: Update.
|
|
The result of running etc/update-copyright.py --this-year, fixing all
the files whose mode is changed by the script, plus a build with
--enable-maintainer-mode --enable-cgen-maint=yes, then checking
out */po/*.pot which we don't update frequently.
The copy of cgen was with commit d1dd5fcc38ead reverted as that commit
breaks building of bfp opcodes files.
|
|
yyleng gives the pattern length, xstrdup just copies up to the NUL.
So it is quite possible writing at an index of yyleng-2 overflows
the xstrdup allocated string buffer. xmemdup quite handily avoids
this problem, even writing the terminating NUL over the trailing
quote. Use it in ldlex.l too where we'd already had a report of this
problem and fixed it by hand, and to implement xmemdup0 in gas.
binutils/
* deflex.l (single and double quote strings): Use xmemdup.
gas/
* as.h (xmemdup0): Use xmemdup.
ld/
PR 20906
* ldlex.l (double quote string): Use xmemdup.
|
|
This tidies the states in which ld lexer rules are enabled.
This change will quite likely trip over issues similar to those
mentioned in the new ldlex.l comments, so please test it out.
* ldgram.y (wildcard_name): Remove now unnecessary components.
* ldlex.l: Restrict many rules' states. Remove -l expression
state rule. Comment on lookahead state madness and need for
/DISCARD/ in expression state.
|
|
I think these happened by accident, so let's see what breaks if they
are removed.
* ldlex.l: Remove lower case "absolute" and "sizeof_headers"
in non-mri mode.
* ld.texi: Remove sizeof_headers index.
* testsuite/ld-mmix/mmohdr1.ld: Use SIZEOF_HEADERS.
|
|
The saga of commit 40726f16a8d7 continues. This attacks the problem
of switching between SCRIPT and EXPRESSION state lexing by removing
the need to do so for phdrs like ":text". Instead {WILDCHAR}*
matching, the reason why ":text" lexed as one token, is restricted to
within the braces of a section or overlay statement. The new WILD
lexer state is switched at the non-optional brace tokens, so
ldlex_backup is no longer needed. I've also removed the BOTH state,
which doesn't seem to be needed any more. Besides rules involving
error reporting, there was just one place where SCRIPT appeared
without BOTH, the {WILDCHAR}* rule, three where BOTH appears without
SCRIPT for tokens that only need EXPRESSION state, and two where BOTH
appears alongside INPUT_LIST. (Since I'm editing the wild and
filename rules, removing BOTH and adding WILD can also be seen as
renaming the old BOTH state to SCRIPT and renaming the old SCRIPT
state to WILD with a reduced scope.)
As a followup, I'll look at removing EXPRESSION state from some lexer
rules that no longer need it due to this cleanup.
PR 28217
* ldgram.y (exp <ORIGIN, LENGTH>): Use paren_script_name.
(section): Parse within braces of section in wild mode, and
after brace back in script mode. Remove ldlex_backup call.
Similarly for OVERLAY.
(overlay_section): Similarly.
(script_file): Replace ldlex_both with ldlex_script.
* ldlex.h (ldlex_wild): Declare.
(ldlex_both): Delete.
* ldlex.l (BOTH): Delete. Remove state from all rules.
(WILD): New state. Enable many tokens in this state.
Enable filename match in SCRIPT mode. Enable WILDCHAR match
in WILD state, disable in SCRIPT mode.
(ldlex_wild): New function.
* ldfile.c (ldfile_try_open_bfd): Replace ldlex_both call with
ldlex_script.
|
|
PR 28198
* ldlex.l: Combine rules for handling newline, whitespace and
comments. Extend # comment handling to all states.
|
|
* ld.texi: Document new output section type.
* ldgram.y: Add new token.
* ldlang.c: Handle the new flag.
* ldlang.h: Add readonly_section to list of section types.
* ldlex.l: Add a new identifier.
* testsuite/ld-scripts/output-section-types.t: New example linker script.
* testsuite/ld-scripts/output-section-types.d: Test driver.
* testsyute/ld-scripts/script.exp: Run the new test.
|
|
This makes --defsym support the same expressions as assignment in a
script. For example, --defsym 'HIDDEN(foo=0)', will define a hidden
visibility foo.
* ldgram.y (defsym_expr): Use assignment rule.
* ldlex.h (ldlex_defsym): Delete.
* ldlex.l (DEFSYMEXP, ldlex_defsym): Delete.
|
|
Parsing symbol or file/section names in ld linker scripts is a little
complicated. Inside SECTIONS, a name might be the start of an
expression or an output section. Is ".foo=x-y" a fancy section name
or is it the expression ".foo = x - y"? It isn't possible for a
single lookahead parser to decide, so the answer in this case is
that it's a section name. This is the reason why everyone writes
linker script assignment expressions with lots of white-space.
However, there are many places where the parser knows for sure that an
expression is expected. Those could be written without whitespace
given the first change to ldlex.l below. Unfortunately, that runs
into a lookahead problem. Optional expressions at the end of an
output section statement require the parser to look ahead one token in
expression context. For this example from standard scripts
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
at the end of the .interp closing brace, the parser is looking for
a possible memspec, phdr, fill or even an optional comma. The next
token is a NAME, but in expression context that NAME now doesn't
include '-' as a valid char. So the lookahead NAME is
".note.gnu.build" with an unexpected "-id" syntax error before the
colon. The rest of the patch involving ldlex_backup arranges to
discard that NAME token so that it will be rescanned in the proper
script context.
* ldgram.y (section): Call ldlex_backup. Remove empty action.
* ldlex.h (ldlex_backup): Declare.
* ldlex.l (<EXPRESSION>NAME): Don't use NOCFILENAMECHAR set of
chars, use SYMBOLNAMECHAR.
(ldlex_backup): New function.
|
|
|
|
As far as I can tell, the following comment is false nowadays.
/* Calls to m-alloc get turned by sed into xm-alloc. */
Remove it, and call xmalloc.
* ldlex.l (yy_create_string_buffer): Use xmalloc rather than malloc.
* lexsup.c (parse_args): Likewise.
|
|
|
|
This is quite complicated because the CTF section's contents depend on
the final contents of the symtab and strtab, because it has two sections
whose contents are shuffled to be in 1:1 correspondence with the symtab,
and an internal strtab that gets deduplicated against the ELF strtab
(with offsets adjusted to point into the ELF strtab instead). It is
also compressed if large enough, so its size depends on its contents!
So we cannot construct it as early as most sections: we cannot even
*begin* construction until after the symtab and strtab are finalized.
Thankfully there is already one section treated similarly: compressed
debugging sections: the only differences are that compressed debugging
sections have extra handling to deal with their changing name if
compressed (CTF sections are always called ".ctf" for now, though we
have reserved ".ctf.*" against future use), and that compressed
debugging sections have previously-uncompressed content which has to be
stashed away for later compression, while CTF sections have no content
at all until we generate it (very late).
BFD also cannot do the link itself: libctf knows how to do it, and BFD
cannot call libctf directly because libctf already depends on bfd for
file I/O. So we have to use a pair of callbacks, one, examine_strtab,
which allows a caller to examine the symtab and strtab after
finalization (called from elf_link_swap_symbols_out(), right before the
symtabs are written, and after the strtab has been finalized), and one
which actually does the emission (called emit_ctf simply because it is
grouped with a bunch of section-specific late-emission function calls at
the bottom of bfd_elf_final_link, and a section-specific name seems best
for that). emit_ctf is actually called *twice*: once from lang_process
if the emulation suggests that this bfd target does not examine the
symtab or strtab, and once via a bfd callback if it does. (This means
that non-ELF targets still get CTF emitted, even though the late CTF
emission stage is never called for them).
v2: merged with non-ELF support patch: slight commit message
adjustments.
v3: do not spend time merging CTF, or crash, if the CTF section is
explicitly discarded. Do not try to merge or compress CTF unless
linking.
v4: add CTF_COMPRESSION_THRESHOLD. Annul the freed input ctf_file_t's
after writeout: set SEC_IN_MEMORY on the output contents so a future
bfd enhancement knows it could free it. Add SEC_LINKER_CREATED |
SEC_KEEP to avoid having to add .ctf to the linker script. Drop
now-unnecessary ldlang.h-level elf-bfd.h include and hackery around
it. Adapt to elf32.em->elf.em and elf-generic.em->ldelf*.c
changes.
v5: fix tabdamage. Drop #inclusions in .h files: include in .c files,
.em files, and use struct forwards instead. Use bfd_section_is_ctf
inline function rather than SECTION_IS_CTF macro. Move a few
comments.
* Makefile.def (dependencies): all-ld depends on all-libctf.
* Makefile.in: Regenerated.
include/
* bfdlink.h (elf_strtab_hash): New forward.
(elf_sym_strtab): Likewise.
(struct bfd_link_callbacks <examine_strtab>): New.
(struct bfd_link_callbacks <emit_ctf>): Likewise.
bfd/
* elf-bfd.h (bfd_section_is_ctf): New inline function.
* elf.c (special_sections_c): Add ".ctf".
(assign_file_positions_for_non_load_sections): Note that
compressed debugging sections etc are not assigned here. Treat
CTF sections like SEC_ELF_COMPRESS sections when is_linker_output:
sh_offset -1.
(assign_file_positions_except_relocs): Likewise.
(find_section_in_list): Note that debugging and CTF sections, as
well as reloc sections, are assigned later.
(_bfd_elf_assign_file_positions_for_non_load): CTF sections get
their size and contents updated.
(_bfd_elf_set_section_contents): Skip CTF sections: unlike
compressed sections, they have no uncompressed content to copy at
this stage.
* elflink.c (elf_link_swap_symbols_out): Call the examine_strtab
callback right before the strtab is written out.
(bfd_elf_final_link): Don't cache the section contents of CTF
sections: they are not populated yet. Call the emit_ctf callback
right at the end, after all the symbols and strings are flushed
out.
ld/
* ldlang.h: (struct lang_input_statement_struct): Add the_ctf.
(struct elf_sym_strtab): Add forward.
(struct elf_strtab_hash): Likewise.
(ldlang_ctf_apply_strsym): Declare.
(ldlang_write_ctf_late): Likewise.
* ldemul.h (ldemul_emit_ctf_early): New.
(ldemul_examine_strtab_for_ctf): Likewise.
(ld_emulation_xfer_type) <emit_ctf_early>: Likewise.
(ld_emulation_xfer_type) <examine_strtab_for_ctf>: Likewise.
* ldemul.c (ldemul_emit_ctf_early): New.
(ldemul_examine_strtab_for_ctf): Likewise.
* ldlang.c: Include ctf-api.h.
(CTF_COMPRESSION_THRESHOLD): New.
(ctf_output): New. Initialized in...
(ldlang_open_ctf): ... this new function. Open all the CTF
sections in the input files: mark them non-loaded and empty
so as not to copy their contents to the output, but linker-created
so the section gets created in the target.
(ldlang_merge_ctf): New, merge types via ctf_link_add_ctf and
ctf_link.
(ldlang_ctf_apply_strsym): New, an examine_strtab callback: wrap
ldemul_examine_strtab_for_ctf.
(lang_write_ctf): New, write out the CTF section.
(ldlang_write_ctf_late): New, late call via bfd's emit_ctf hook.
(lang_process): Call ldlang_open_ctf, ldlang_merge_ctf, and
lang_write_ctf.
* ldmain.c (link_callbacks): Add ldlang_ctf_apply_strsym,
ldlang_write_ctf_late.
* emultempl/aix.em: Add ctf-api.h.
* emultempl/armcoff.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/elf.em: Likewise.
* emultempl/generic.em: Likewise.
* emultempl/linux.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ticoff.em: Likewise.
* emultempl/vanilla.em: Likewise.
* ldcref.c: Likewise.
* ldctor.c: Likewise.
* ldelf.c: Likewise.
* ldelfgen.c: Likewise.
* ldemul.c: Likewise.
* ldexp.c: Likewise.
* ldfile.c: Likewise.
* ldgram.c: Likewise.
* ldlex.l: Likewise.
* ldmain.c: Likewise.
* ldmisc.c: Likewise.
* ldver.c: Likewise.
* ldwrite.c: Likewise.
* lexsup.c: Likewise.
* mri.c: Likewise.
* pe-dll.c: Likewise.
* plugin.c: Likewise.
* ldelfgen.c (ldelf_emit_ctf_early): New.
(ldelf_examine_strtab_for_ctf): tell libctf about the symtab and
strtab.
(struct ctf_strsym_iter_cb_arg): New, state to do so.
(ldelf_ctf_strtab_iter_cb): New: tell libctf about
each string in the strtab in turn.
(ldelf_ctf_symbols_iter_cb): New, tell libctf
about each symbol in the symtab in turn.
* ldelfgen.h (struct elf_sym_strtab): Add forward.
(struct elf_strtab_hash): Likewise.
(struct ctf_file): Likewise.
(ldelf_emit_ctf_early): Declare.
(ldelf_examine_strtab_for_ctf): Likewise.
* emultempl/elf-generic.em (LDEMUL_EMIT_CTF_EARLY): Set it.
(LDEMUL_EXAMINE_STRTAB_FOR_CTF): Likewise.
* emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add
emit_ctf_early and examine_strtab_for_ctf, NULL by default.
* emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/linux.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise.
* emultempl/vanilla.em (ld_vanilla_emulation): Likewise.
* Makefile.am: Pull in libctf (and zlib, a transitive requirement
for compressed CTF section emission). Pass it on to DejaGNU.
* configure.ac: Add AM_ZLIB.
* aclocal.m4: Added zlib.m4.
* Makefile.in: Regenerated.
* testsuite/ld-bootstrap/bootstrap.exp: Use it when relinking ld.
|
|
YY_INPUT returns 0 on end of input, not EOF.
PR 24827
* ldlex.l (comment): Check for 0 return from input(), not EOF.
|
|
Let's hope no one has section names starting with '/' in scripts. If
they do, this change to fix parsing of '/' in expressiongs will break
their project.
PR 24411
ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
(<EXPRESSION>"/DISCARD/"): New.
|
|
Underscore was specified twice in all these patterns, and backslash
twice in some. Flex warned about the $SYSROOT rule, which is covered
by earlier rules: "ldlex.l:386: warning, rule cannot be matched".
* ldlex.l: Formatting.
(CMDFILENAMECHAR, CMDFILENAMECHAR1): Delete.
(FILENAMECHAR1, SYMBOLNAMECHAR1, FILENAMECHAR, WILDCHAR),
(NOCFILENAMECHAR): Remove duplicate chars. Reorder.
(SYMBOLCHARN): Likewise. Rename to SYMBOLNAMECHAR.
(<INPUTLIST>"$SYSROOT"..): Delete rule.
|
|
|
|
A small rework of the PRU GCC port exposed that CIE data alignment is
erroneously set to 4 for PRU in GAS. In fact PRU stack must be aligned to 1.
Set the macro to -1, to allow output from GCC to be assembled without errors.
Also, while at it, set DWARF2 HW register numbering to follow latest
* config/tc-pru.c (pru_regname_to_dw2regnum): Return the starting HW
byte-register number.
(pru_frame_initial_instructions): Use byte-numbering for FP index.
* config/tc-pru.h (DWARF2_DEFAULT_RETURN_COLUMN): Use number from
latest GCC.
(DWARF2_CIE_DATA_ALIGNMENT): Set to -1.
|
|
bfd/
* elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c,
* elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c,
* elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c,
* elf64-ppc.c, * elf64-s390.c, * elflink.c, * elfnn-aarch64.c,
* elfnn-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c,
* reloc.c: Replace use of %R and %T in format strings passed to
einfo and friends by %pR and %pT.
ld/
* ldmisc.c (vfinfo) Handle %pI, %pR, %pS and %pT in place of
%I, %R, %S and %T.
* ldcref.c, * ldctor.c, * ldemul.c, * ldexp.c, * ldgram.y,
* ldlang.c, * ldlex.l, * ldmain.c, * ldmisc.c, * pe-dll.c,
* emultempl/sh64elf.em: Replace use of of %I, %R, %S and %T in
format strings passed to einfo and friends by %pI, %pR, %pS and %pT.
|
|
|
|
* pe-dll.c: Formatting, whitespace fixes.
* NEWS: Whitespace fixes.
* configure.ac: Likewise.
* configure.tgt: Likewise.
* deffilep.y: Likewise.
* genscripts.sh: Likewise.
* ld.texinfo: Likewise.
* ldgram.y: Likewise.
* ldlang.c: Likewise.
* ldlex.l: Likewise.
* lexsup.c: Likewise.
* plugin.c: Likewise.
* emulparams/arc-endianness.sh: Likewise.
* emulparams/elf32_x86_64.sh: Likewise.
* emulparams/elf64mmix.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/h8300elf.sh: Likewise.
* emulparams/h8300elf_linux.sh: Likewise.
* emulparams/vxworks.sh: Likewise.
* emultempl/aarch64elf.em: Likewise.
* emultempl/aix.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/avrelf.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/m68kcoff.em: Likewise.
* emultempl/m68kelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/nds32elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/sh64elf.em: Likewise.
* emultempl/spu_ovl.S: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.
* emultempl/ticoff.em: Likewise.
* emultempl/vms.em: Likewise.
* po/Make-in: Likewise.
* scripttempl/DWARF.sc: Likewise.
* scripttempl/aix.sc: Likewise.
* scripttempl/alpha.sc: Likewise.
* scripttempl/alphavms.sc: Likewise.
* scripttempl/aout.sc: Likewise.
* scripttempl/arclinux.sc: Likewise.
* scripttempl/armaout.sc: Likewise.
* scripttempl/armbpabi.sc: Likewise.
* scripttempl/armcoff.sc: Likewise.
* scripttempl/avr.sc: Likewise.
* scripttempl/crisaout.sc: Likewise.
* scripttempl/delta68.sc: Likewise.
* scripttempl/dlx.sc: Likewise.
* scripttempl/elf.sc: Likewise.
* scripttempl/elf32cr16.sc: Likewise.
* scripttempl/elf32cr16c.sc: Likewise.
* scripttempl/elf32crx.sc: Likewise.
* scripttempl/elf32msp430.sc: Likewise.
* scripttempl/elf32msp430_3.sc: Likewise.
* scripttempl/elf32sh-symbian.sc: Likewise.
* scripttempl/elf32xc16x.sc: Likewise.
* scripttempl/elf32xc16xl.sc: Likewise.
* scripttempl/elf32xc16xs.sc: Likewise.
* scripttempl/elf64hppa.sc: Likewise.
* scripttempl/elf_chaos.sc: Likewise.
* scripttempl/elfarc.sc: Likewise.
* scripttempl/elfarcv2.sc: Likewise.
* scripttempl/elfd10v.sc: Likewise.
* scripttempl/elfd30v.sc: Likewise.
* scripttempl/elfi370.sc: Likewise.
* scripttempl/elfm68hc11.sc: Likewise.
* scripttempl/elfm68hc12.sc: Likewise.
* scripttempl/elfmicroblaze.sc: Likewise.
* scripttempl/elfxgate.sc: Likewise.
* scripttempl/elfxtensa.sc: Likewise.
* scripttempl/epiphany_4x4.sc: Likewise.
* scripttempl/epocpe.sc: Likewise.
* scripttempl/h8300.sc: Likewise.
* scripttempl/h8300h.sc: Likewise.
* scripttempl/h8300hn.sc: Likewise.
* scripttempl/h8300s.sc: Likewise.
* scripttempl/h8300sn.sc: Likewise.
* scripttempl/h8300sx.sc: Likewise.
* scripttempl/h8300sxn.sc: Likewise.
* scripttempl/h8500.sc: Likewise.
* scripttempl/h8500b.sc: Likewise.
* scripttempl/h8500c.sc: Likewise.
* scripttempl/h8500m.sc: Likewise.
* scripttempl/h8500s.sc: Likewise.
* scripttempl/hppaelf.sc: Likewise.
* scripttempl/i386beos.sc: Likewise.
* scripttempl/i386coff.sc: Likewise.
* scripttempl/i386go32.sc: Likewise.
* scripttempl/i386msdos.sc: Likewise.
* scripttempl/i860coff.sc: Likewise.
* scripttempl/i960.sc: Likewise.
* scripttempl/ia64vms.sc: Likewise.
* scripttempl/ip2k.sc: Likewise.
* scripttempl/iq2000.sc: Likewise.
* scripttempl/m68kaux.sc: Likewise.
* scripttempl/m68kcoff.sc: Likewise.
* scripttempl/m88kbcs.sc: Likewise.
* scripttempl/mcorepe.sc: Likewise.
* scripttempl/mep.sc: Likewise.
* scripttempl/mips.sc: Likewise.
* scripttempl/mipsbsd.sc: Likewise.
* scripttempl/mmo.sc: Likewise.
* scripttempl/moxie.sc: Likewise.
* scripttempl/nds32elf.sc: Likewise.
* scripttempl/nw.sc: Likewise.
* scripttempl/pe.sc: Likewise.
* scripttempl/pep.sc: Likewise.
* scripttempl/pj.sc: Likewise.
* scripttempl/ppcpe.sc: Likewise.
* scripttempl/psos.sc: Likewise.
* scripttempl/riscix.sc: Likewise.
* scripttempl/sh.sc: Likewise.
* scripttempl/sparccoff.sc: Likewise.
* scripttempl/st2000.sc: Likewise.
* scripttempl/tic30aout.sc: Likewise.
* scripttempl/tic30coff.sc: Likewise.
* scripttempl/tic4xcoff.sc: Likewise.
* scripttempl/tic54xcoff.sc: Likewise.
* scripttempl/tic80coff.sc: Likewise.
* scripttempl/v850.sc: Likewise.
* scripttempl/v850_rh850.sc: Likewise.
* scripttempl/vanilla.sc: Likewise.
* scripttempl/visium.sc: Likewise.
* scripttempl/w65.sc: Likewise.
* scripttempl/xstormy16.sc: Likewise.
* scripttempl/z80.sc: Likewise.
* scripttempl/z8000.sc: Likewise.
* configure: Regenerate.
|
|
* emultempl/aarch64elf.em: Wrap einfo strings in _(). Formatting.
* emultempl/aix.em: Likewise.
* emultempl/armcoff.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/avrelf.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/cr16elf.em: Likewise.
* emultempl/elf-generic.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/genelf.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/linux.em: Likewise.
* emultempl/lnk960.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/m68kcoff.em: Likewise.
* emultempl/m68kelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/mmix-elfnmmo.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/nds32elf.em: Likewise.
* emultempl/nios2elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/riscvelf.em: Likewise.
* emultempl/s390.em: Likewise.
* emultempl/scoreelf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/sunos.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.
* emultempl/v850elf.em: Likewise.
* emultempl/vms.em: Likewise.
* emultempl/vxworks.em: Likewise.
* ldcref.c: Likewise.
* ldlang.c: Likewise.
* ldlex.l: Likewise.
* ldmain.c: Likewise.
* pe-dll.c: Likewise.
* plugin.c: Likewise.
|
|
Don't allow '~' as the first character in symbol name in linker script.
PR ld/22267
* ldlex.l (SYMBOLNAMECHAR1) New.
(DEFSYMEXP): Replace FILENAMECHAR1 with SYMBOLNAMECHAR1.
(EXPRESSION): Likewise.
* testsuite/ld-scripts/expr.exp: Run pr22267.
* testsuite/ld-scripts/pr22267.d: New file.
* testsuite/ld-scripts/pr22267.s: Likewise.
* testsuite/ld-scripts/pr22267.t: Likewise.
|
|
This commit adds a new linker feature: the ability to resolve section
groups as part of a relocatable link.
Currently section groups are automatically resolved when performing a
final link, and are carried through when performing a relocatable link.
By carried through this means that one copy of each section group (from
all the copies that might be found in all the input files) is placed
into the output file. Sections that are part of a section group will
not match input section specifiers within a linker script and are
forcibly kept as separate sections.
There is a slight resemblance between section groups and common
section. Like section groups, common sections are carried through when
performing a relocatable link, and resolved (allocated actual space)
only at final link time.
However, with common sections there is an ability to force the linker to
allocate space for the common sections when performing a relocatable
link, there's currently no such ability for section groups.
This commit adds such a mechanism. This new facility can be accessed in
two ways, first there's a command line switch --force-group-allocation,
second, there's a new linker script command FORCE_GROUP_ALLOCATION. If
one of these is used when performing a relocatable link then the linker
will resolve the section groups as though it were performing a final
link, the section group will be deleted, and the members of the group
will be placed like normal input sections. If there are multiple copies
of the group (from multiple input files) then only one copy of the group
members will be placed, the duplicate copies will be discarded.
Unlike common sections that have the --no-define-common command line
flag, and INHIBIT_COMMON_ALLOCATION linker script command there is no
way to prevent group resolution during a final link, this is because the
ELF gABI specifically prohibits the presence of SHT_GROUP sections in a
fully linked executable. However, the code as written should make
adding such a feature trivial, setting the new resolve_section_groups
flag to false during a final link should work as you'd expect.
bfd/ChangeLog:
* elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
SEC_GROUP sections as SEC_EXCLUDE.
(bfd_elf_set_group_contents): Replace use of abort with an assert.
(assign_section_numbers): Use resolve_section_groups flag instead
of relocatable link type.
(_bfd_elf_init_private_section_data): Use resolve_section_groups
flag instead of checking the final_link flag for part of the
checks in here. Fix white space as a result.
* elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
instead of relocatable link type.
(bfd_elf_final_link): Likewise.
include/ChangeLog:
* bfdlink.h (struct bfd_link_info): Add new resolve_section_groups
flag.
ld/ChangeLog:
* ld.h (struct args_type): Add force_group_allocation field.
* ldgram.y: Add support for FORCE_GROUP_ALLOCATION.
* ldlex.h: Likewise.
* ldlex.l: Likewise.
* lexsup.c: Likewise.
* ldlang.c (unique_section_p): Check resolve_section_groups flag
not the relaxable link flag.
(lang_add_section): Discard section groups when we're resolving
groups. Clear the SEC_LINK_ONCE flag if we're resolving section
groups.
* ldmain.c (main): Initialise resolve_section_groups flag in
link_info based on command line flags.
* testsuite/ld-elf/group11.d: New file.
* testsuite/ld-elf/group12.d: New file.
* testsuite/ld-elf/group12.ld: New file.
* NEWS: Mention new features.
* ld.texinfo (Options): Document --force-group-allocation.
(Miscellaneous Commands): Document FORCE_GROUP_ALLOCATION.
|
|
search paths.
PR ld/21251
* ldfile.c (ldfile_add_library_path): If the path starts with
$SYSROOT then use the sysroot as the real prefix.
* ldlang.c (lang_add_input_file): Treat $SYSROOT in the same
way as =.
* ldlex.l: Add $SYSROOT as allow prefix for a filename.
* ld.texinfo (-L): Document that $SYSROOT acts like = when
prefixing a library search path.
(INPUT): Likewise.
* testsuite/ld-scripts/sysroot-prefix.exp: Add $SYSROOT prefix
tests.
|
|
ld PR 20958
* ldlex.l (option): Add noyywrap
(yywrap): Delete.
* ldlex.h (yywrap): Delete prototype.
binutils
PR 20958
* syslex.l (option): Add noyywrap
(yywrap): Delete.
|
|
|
|
PR ld/20906
* ldlex.l: Check for bogus strings in linker scripts.
|
|
Keep "lineno" as zero while not processing any script, and use it being
zero to set the "linker_def" field to true.
|
|
NOCROSSREFS_TO is similar to the existing NOCROSSREFS command but only
checks one direction of cross referencing.
ld/ChangeLog
* ld.texinfo: Document NOCROSSREFS_TO script command.
* ldlang.h (struct lang_nocrossrefs): Add onlyfirst field.
(lang_add_nocrossref_to): New prototype.
* ldcref.c (check_local_sym_xref): Use onlyfirst to only look for
symbols defined in the first section.
(check_nocrossref): Likewise.
* ldgram.y (NOCROSSREFS_TO): New script command.
* ldlang.c (lang_add_nocrossref): Set onlyfirst to FALSE.
(lang_add_nocrossref_to): New function.
* ldlex.l (NOCROSSREFS_TO): New token.
* NEWS: Mention NOCROSSREFS_TO.
* testsuite/ld-scripts/cross4.t: New file.
* testsuite/ld-scripts/cross5.t: Likewise.
* testsuite/ld-scripts/cross6.t: Likewise.
* testsuite/ld-scripts/cross7.t: Likewise.
* testsuite/ld-scripts/crossref.exp: Run 4 new NOCROSSREFS_TO
tests.
|
|
|
|
ld/
PR ld/18344
* ldlex.l (INPUTLIST): Increment lineno on newline.
|