Commit Graph

140 Commits

Author SHA1 Message Date
Nathan Sidwell e5caec89a0 * elf.c (map_sections_to_segments): Ignore .tbss sections for
layout purposes.

	* ldlang.c (lang_add_section): Don't force SEC_LOAD on
	SEC_THREAD_LOCAL.
	(IGNORE_SECTION): Ignore .tbss sections too.
	(lang_size_sections_1): .tbss sections do not advance dot.

	* ld-scripts/size.exp: New.
	* ld-scripts/size-[12].{d,s,t}: New.
2004-03-05 11:26:05 +00:00
Ian Lance Taylor 177b729b44 * ldlang.c (lang_check): Use %P, not %E, in error message. 2004-02-23 19:41:53 +00:00
Nathan Sidwell 1b49374200 * ldlang.h (struct lang_output_section_state): Change processed
field's type.
	* ldexp.c (check, invalid): Remove.
	(fold_name): Move valid_p assignments. Create undefined symbol
	when needed. Directly exampine section's processd flag.
	* ldlang.c (lang_output_section_statement_lookup): Adjust
	processed field init.
	(lang_size_sections_1): Allow LOADADDR when determining section's
	VMA. Adjust error message. Fold data statement's expr.
	(lang_size_sections): Correctly increment lang_statement_iteration.

	* ld-scripts/provide.exp: New.
	* ld-scripts/provide-{1,2,3}.{s,t,d}.exp: New.

	* ldexp.c (fold_tree): Follow indirect symbols.
2004-02-23 10:10:02 +00:00
Nathan Sidwell 384d938fc8 * ldlang.c (map_input_to_output_sections): Initialize sections
mentioned in a data statement expression.
	(lang_do_assignments_1): Add data statement's expression's
	section's vma.
	* ld-scripts/data.{s,t,d,exp}: New.
2004-02-19 14:08:31 +00:00
Nathan Sidwell b6ca8815ef * ldgram.y (statement_anywhere): Add assert rule.
* ldlang.c (exp_init_os): Add assert case.
	* testsuite/ld-scripts/assert.{s,t,exp}: New.
2004-02-18 16:37:21 +00:00
Nick Clifton 6bdafbeb57 * ldlang.c (lang_get_regions): Add extra parameter 'have_vma' which if true will
prevent the LMA region being used as a replacement for a default VMA region.
  (lang_leave_output_section_statement): Pass extra parameter.
  (lang_leave_overlay): Likewise.
* ld.texinfo (Output Section LMA): Document that the LMA region can be set to
  the VMA region if no VMA has been set.
* ldlang.h (struct lang_output_section_phdr_list): Create a typedef for this
  type.  Minor formatting fixes.
2004-01-13 11:10:53 +00:00
Nick Clifton 9dfc8ab287 If dot is advanced, then assume that the section should be allocated. 2004-01-13 08:24:20 +00:00
Alan Modra 8325c4dd4e * ldlang.c (IGNORE_SECTION): Don't ignore SEC_ALLOC && !SEC_LOAD
sections.  Do ignore SEC_NEVER_LOAD sections.
	(lang_size_sections_1): Remove test made redundant with the above.
2004-01-12 13:47:32 +00:00
Alan Modra e5caa5e0ca * ldexp.c (align_n): Make static.
* ldexp.h (align_n): Delete declaration.
	* ldlang.h (lang_enter_output_section_statement): Remove
	block_value param.
	* ldlang.c (lang_enter_output_section_statement): Likewise.
	(TO_ADDR, TO_SIZE): Define.
	(opb): New var.
	(init_opb): New function.
	(print_input_section): Call init_opb and use TO_ADDR.
	(print_data_statement, print_reloc_statement): Likewise.
	(print_padding_statement): Likewise.
	(size_input_section): Use TO_SIZE and TO_ADDR, and global opb.
	(lang_check_section_addresses): Likewise.
	(lang_size_sections_1): Likewise.
	(lang_do_assignments_1): Likewise.
	(lang_set_startof): Likewise.
	(lang_one_common): Likewise.  Combine power_of_two and opb alignment.
	(lang_process): Call init_opb.
	(lang_abs_symbol_at_end_of): Use TO_ADDR and global opb.
	(lang_enter_overlay_section): Adjust
	lang_enter_output_section_statement call.
	* ldgram.y: Likewise.
	* mri.c (mri_draw_tree): Likewise.
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Likewise.
	* emultempl/mmo.em (mmo_place_orphan): Likewise.
	* emultempl/pe.em (gld${EMULATION_NAME}_place_orphan): Likewise.
2004-01-03 12:39:07 +00:00
H.J. Lu 2f97444a4f 2003-12-07 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (lang_vers_match): Pass "DMGL_PARAMS | DMGL_ANSI" to
	cplus_demangle.
2003-12-08 03:43:33 +00:00
H.J. Lu d9c458fcc1 bfd/
2003-12-04  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_relax_section): Use the
	need_relax_finalize field in link_info instead of
	relax_finalizing to check if the relax finalize pass is being
	done.

include/

2003-12-04  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Change relax_finalizing to
	need_relax_finalize.

ld/

2003-12-04  H.J. Lu  <hongjiu.lu@intel.com>

	* emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse): Set
	link_info.need_relax_finalize to TRUE.

	* ldlang.c (lang_process): Use link_info.need_relax_finalize
	instead of link_info.relax_finalizing.
	* ldmain.c (main): Likewise.
2003-12-04 22:43:36 +00:00
Alan Modra f2241121e3 * ldlang.c (lang_do_assignments): Function return is void.
* ldlang.h (lang_do_assignments): Ditto.
	* emultempl/netbsd.em (gld${EMULATION_NAME}_before_parse): Declare.
	* Makefile.am (ens32knbsd.c): Depend on netbsd.em.
	* Makefile.in: Regenerate.
2003-12-04 12:09:25 +00:00
Jim Wilson 5a46fe39b3 Fix IA-64 linker failure reported by Andreas Schwab.
* ldlang.c (lang_process): Move lang_reset_memory_regions call after
	lang_do_assignments call.
2003-11-19 02:40:55 +00:00
Nick Clifton 0013291dce When looking for a previously loaded file compare the local_sym_name not the
filename, as the filename might have been transformed via the search directory
path lookup.  If the sought-for file has not been found in the input file
chain then create a new node with the search_dirs_flag set so that the entire
set of directory paths will be scanned for it.
2003-10-31 10:27:34 +00:00
Kazu Hirata 07f3b6ad4a * ChangeLog-9197: Fix typos.
* NEWS: Likewise.
	* ld.texinfo: Likewise.
	* ldlang.c: Fix comment typos.
2003-10-25 16:26:30 +00:00
H.J. Lu df8162158d 2003-10-24 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (lang_vers_match): Fix a typo.
2003-10-24 18:55:39 +00:00
H.J. Lu 7a995eb391 2003-10-24 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (lang_vers_match): Check demangled symbols.
2003-10-24 15:40:20 +00:00
H.J. Lu 5e35cbc224 bfd/
2003-10-24  H.J. Lu  <hongjiu.lu@intel.com>

	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Look up
	hash table for real symbols.

include/

2003-10-24  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_elf_version_expr): Add "symbol" and remove
	"wildcard".

ld/

2003-10-24  H.J. Lu  <hongjiu.lu@intel.com>

	* ldlang.c (lang_vers_match): Check "symbol" instead of
	"wildcard" and "pattern". Fix a typo.
	(lang_finalize_version_expr_head): Likewise.
	(lang_register_vers_node): Likewise.
	(realsymbol): New function.
	(lang_new_vers_pattern): Set "symbol" and remove "wildcard".

	* ldlex.l (V_IDENTIFIER): Allow '\\'.
2003-10-24 14:55:14 +00:00
Jakub Jelinek 108ba30509 bfd/
* elflink.c (_bfd_elf_export_symbol): Adjust for globals and locals
	field changes.
	(_bfd_elf_link_assign_sym_version): Likewise.
	* elflink.h (size_dynamic_sections): Likewise.
include/
	* bfdlink.h (struct bfd_elf_version_expr): Remove match field.
	Add wildcard and mask fields.
	(BFD_ELF_VERSION_C_TYPE): Define.
	(BFD_ELF_VERSION_CXX_TYPE): Likewise.
	(BFD_ELF_VERSION_JAVA_TYPE): Likewise.
	(struct bfd_elf_version_expr_head): New.
	(struct bfd_elf_version_tree): Add match field.
	Change type of globals and locals fields
	to struct bfd_elf_version_expr_head.
ld/
	* ldlang.c: Include hashtab.h.
	(lang_vers_match_lang_c, lang_vers_match_lang_cplusplus,
	lang_vers_match_lang_java): Remove.
	(lang_vers_match): New function.
	(lang_new_vers_pattern): Initialize wildcard and mask
	fields, don't initialize match.
	(lang_new_vers_node): Use xcalloc.  Adjust for globals and
	locals field type changes.  Set match field.
	(version_expr_head_hash, version_expr_head_eq): New functions.
	(lang_finalize_version_expr_head): New function.
	(lang_register_vers_node): Call lang_finalize_version_expr_head.
	Search in hash table if not wildcard when looking for duplicates.
	* emultempl/ppc64elf.em (new_vers_pattern): Don't bother with
	duplicate checking.  Initialize all fields of dot_entry from entry
	with the exception of pattern and next.
2003-10-22 06:58:17 +00:00
Nick Clifton a747ee4d51 Add warning messages for the use of an undeclared memory region and the
redefintion of an already declared region.
2003-10-21 15:33:47 +00:00
Hans-Peter Nilsson 86d3c9a824 * ldlang.c (lang_size_sections): Last, set _cooked_size for output
sections.
2003-10-17 23:05:50 +00:00
Hans-Peter Nilsson 420e579cc4 * ld.texinfo (Builtin Functions) <DEFINED>: Say that only symbols
defined before the statement using DEFINED yield 1.
	* ldexp.c (fold_name) <case DEFINED>: In lang_first_phase_enum,
	call lang_track_definedness on symbol.  In subsequent phases, use
	lang_symbol_definition_iteration and lang_statement_iteration to
	check whether the symbol was defined before the current statement.
	(exp_fold_tree) <case etree_assign et al>: Call
	lang_update_definedness before updating symbol type when setting
	symbol.
	* ldlang.c (lang_definedness_table): New variable.
	(lang_definedness_newfunc, lang_track_definedness)
	(lang_symbol_definition_iteration, lang_update_definedness): New
	functions.
	(lang_init): Initialize lang_definedness_table and
	lang_statement_iteration.
	(lang_finish): Destroy bfd_hash_table_free.
	(lang_size_sections): Increment lang_statement_iteration.
	(lang_do_assignments_1): New function with former
	lang_do_assignments contents.  Change recursive calls to call this
	function.
	(lang_do_assignments): Evacuate contents.  Increment
	lang_statement_iteration, then just call lang_do_assignments_1.
	* ldlang.h (struct lang_definedness_hash_entry)
	(lang_statement_iteration, lang_track_definedness)
	(lang_symbol_definition_iteration, lang_update_definedness):
	Declare.
2003-10-11 09:16:20 +00:00
Alexandre Oliva a7f18fb387 * ldlang.c (lang_size_sections_1): Use IGNORE_SECTION to tell
whether to skip test for no memory region.
2003-10-08 22:17:35 +00:00
Alan Modra 7e7d57681b * ld.texinfo: Typo fixes. Document SUBALIGN.
* ldgram.y (opt_subalign): Add.
	* ldlex.l (SUBALIGN): Recognize.
	* ldlang.c (overlay_subalign): New var.
	(lang_enter_overlay): Add subalign param.
	(lang_enter_overlay_section): Pass overlay_subalign to
	lang_enter_output_section_statement.
	* ldlang.h (lang_enter_overlay): Update.
2003-07-27 11:58:28 +00:00
Alan Modra 1579bae1cd Convert to C90 2003-06-28 05:28:54 +00:00
Alan Modra 1049f94e8e Correct spelling of "relocatable". 2003-06-25 06:40:27 +00:00
H.J. Lu f97b9cb853 bfd/
2003-06-17  H.J. Lu <hongjiu.lu@intel.com>

	* section.c (struct sec): Put back kept_section.
	(STD_SECTION): Put back kept_section initialization.
	* bfd-in2.h: Regenerate.

	* elflink.h (elf_link_input_bfd): Also check discarded linkonce
	sections for relocateable output. Use kept_section to preserve
	debug information discarded by linkonce.

ld/

2003-06-17  H.J. Lu <hongjiu.lu@intel.com>

	* ldlang.c (section_already_linked): Put back assignment of
	kept_section.
2003-06-18 00:30:04 +00:00
Nick Clifton 661849791b Default to generating a fatal error message if a loadable section is not
allocated to a memory region when regions are defined.
2003-05-09 16:12:07 +00:00
H.J. Lu c7996ad628 bfd/
2003-04-28  H.J. Lu <hjl@gnu.org>

	* elfxx-ia64.c (elfNN_ia64_relax_section): Relax ldxmov during
	the relax finalize pass.

	* section.c (struct sec): Add need_finalize_relax and remove
	flag11.
	(STD_SECTION): Update struct sec initializer.
	* bfd-in2.h: Regenerated.

include/

2003-04-28  H.J. Lu <hjl@gnu.org>

	* bfdlink.h (bfd_link_info): Add relax_finalizing.

ld/

2003-04-28  H.J. Lu <hjl@gnu.org>

	* ldlang.c (lang_process): Add the relax finalize pass.

	* ldmain.c (main): Initialize link_info.relax_finalizing to
	FALSE.
2003-04-29 01:53:46 +00:00
Nick Clifton 5ed6aba41c Fix memory leaks 2003-03-31 18:13:25 +00:00
Alexandre Oliva e3f2db7fa6 * ldfile.h (struct search_dirs): Added sysrooted field.
* ldlang.h (struct lang_input_statement_struct): Likewise.
* ldfile.c (ldfile_add_library_path): Mark sysrooted paths.
(ldfile_open_file_search): Look for sysrooted filename starting
with / in ld_sysroot instead of in the current directory.  Clear
sysrooted flag if it's found in the current directory.  Set it
from the search directory's sysrooted flag where it is found
otherwise.
* ldlang.c (ldlang_sysrooted_script): New static variable.
(new_afile): Mark search_file_enums as sysrooted if
ldlang_sysrooted_script.
(load_symbols): Set ldlang_sysrooted_script according to the
script's sysrooted field while processing it.
* ld.texinfo: Document INPUT behavior in sysroot.
2003-03-03 20:00:35 +00:00
Nick Clifton cf888e70e2 Disable region size checking whilst relaxing sections. 2003-02-21 10:51:24 +00:00
Kazu Hirata 396a246719 * ldfile.c: Fix comment typos.
* ldlang.c: Likewise.
	* mri.c: Likewise.
	* pe-dll.c: Likewise.
2003-01-02 03:53:53 +00:00
Nick Clifton 312b768e2f Change linker's default behaviour - it will now reject binary files whoes
architecture it does not recognise, unless it has explicitly told to accept
them.
2002-12-23 10:45:03 +00:00
Alan Modra 18794b0c44 * ldlang.c (init_os): Ensure sections mentioned in load_base
are initialized.
2002-12-06 22:33:18 +00:00
Alan Modra b34976b65a s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE.  Formatting.
2002-11-30 08:39:46 +00:00
Alan Modra c4c4121963 * ldlang.c (lang_add_section): Discard debugging sections that have
been marked SEC_EXCLUDE.
2002-11-12 11:31:43 +00:00
Daniel Jacobowitz df2a731323 * emultempl/aix.em: Use include <> for generated headers.
* emultempl/beos.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/pe.em: Likewise.
	* ldctor.c: Likewise.
	* ldexp.c: Likewise.
	* ldfile.c: Likewise.
	* ldlang.c: Likewise.
	* ldlex.c: Likewise.
	* ldlex.l: Likewise.
	* ldmain.c: Likewise.
	* ldmisc.c: Likewise.
	* ldwrite.c: Likewise.
	* lexsup.c: Likewise.
	* mri.c: Likewise.
	* pe-dll.c: Likewise.
2002-10-30 03:57:39 +00:00
Alan Modra 03bdc40405 * ldlang.c (load_symbols): Revert last change. 2002-10-15 00:09:02 +00:00
Alan Modra 7c519c12a3 * ldlang.c (load_symbols): Don't call bfd_link_add_symbols when
just_syms_flag.
	(lang_reasonable_defaults): Don't compare against false.
	(size_input_section): Likewise.
	(lang_size_sections_1): Likewise.
	(lang_do_assignments): Likewise.
	(lang_add_output): Likewise.
2002-10-14 13:08:19 +00:00
Jakub Jelinek 599917b82b * ldfile.c (ldfile_try_open_bfd): When searching skip linker scripts if
they have OUTPUT_FORMAT not matching actual output format.
	* ldlang.c (lang_get_output_target): New function.
	(open_output): Use it.
	* ldlang.h (lang_get_output_target): New prototype.
2002-10-10 15:59:10 +00:00
H.J. Lu c04c958616 2002-10-08 H.J. Lu <hjl@gnu.org>
* ldlang.c (lang_file_exist): Removed.
	(new_afile): Revert the last change.
	* ldlang.h (lang_file_exist): Removed.
	* lexsup.c (parse_args): Revert the last change.
2002-10-08 20:12:45 +00:00
Nick Clifton 53b2a62f07 Abort if the filename to be added matches the linker output filename. 2002-10-07 16:08:21 +00:00
Alan Modra 7abb6dea2c * ldlang.c (offsetof): Define if not defined. 2002-08-20 23:48:18 +00:00
Alan Modra c553bb910d * emulparams/elf32_dlx.sh (TARGET_PAGE_SIZE): Set to 1.
(MAXPAGESIZE): Set to 1.

	* ld.h (ALIGN_N): Delete.
	* ldexp.h (align_n): Declare.
	* ldexp.c (align_n): New function.
	(fold_binary): Use align_n instead of ALIGN_N.
	(exp_fold_tree): Likewise.
	* ldlang.c (lang_size_sections_1): Likewise.
	(lang_one_common): Likewise.
2002-08-13 02:08:26 +00:00
H.J. Lu 3194163592 Check symbols with undefine version. 2002-08-08 03:50:18 +00:00
Jakub Jelinek 704afa601f * elf.c (elf_fake_sections): Fix up .tbss sh_size and sh_type.
* ldlang.c (lang_add_section): Don't turn .tbss into normal sections
	for relocatable link.
	(lang_size_sections_1): Don't make .tbss zero size for relocatable
	link.
2002-07-30 14:28:55 +00:00
Alan Modra 34786259b8 * ldlang.c (print_wild_statement): Fix output formatting. 2002-07-05 12:54:28 +00:00
Alan Modra 4bd5a3935b * ldlang.c: (strip_excluded_output_sections): New function.
(lang_process): Call it.
	(lang_size_sections_1): Revert 2002-06-10 change.
2002-07-04 14:41:01 +00:00
Alan Modra e3e942e990 * ldlang.h (entry_sym): Make it a struct bfd_sym_chain.
* ldlang.c (entry_sym): Likewise.
	(ldlang_undef_chain_list_type): Likewise.
	(lang_finish): Adjust references to entry_symbol.
	(lang_add_entry): Likewise.
	(lang_gc_sections): Use link_info.gc_sym_list.
	(lang_process): Set link_info.gc_sym_list.
	* ldlex.l: Include bfdlink.h.
	* ldmain.c (main): Init link_info.gc_sym_list.
	* emultempl/aix.em: Adjust references to entry_symbol.
	* emultempl/armcoff.em: Likewise.
	* emultempl/armelf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/ppc64elf.em (ppc_after_open): New function.
	(LDEMUL_AFTER_OPEN): Define.
	* emulparams/elf64ppc.sh: KEEP .opd sections.
2002-07-01 08:07:31 +00:00