old-cross-binutils/gas/doc
H.J. Lu 8dcea93252 Add -mshared option to x86 ELF assembler
This patch adds -mshared option to x86 ELF assembler.  By default,
assembler will optimize out non-PLT relocations against defined non-weak
global branch targets with default visibility.  The -mshared option tells
the assembler to generate code which may go into a shared library
where all non-weak global branch targets with default visibility can
be preempted.  The resulting code is slightly bigger.  This option
only affects the handling of branch instructions.

This Linux kernel patch is needed to create a working x86 Linux kernel if
it hasn't been applied:

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index ae6588b..b91a00c 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -339,8 +339,8 @@ early_idt_handlers:
 	i = i + 1
 	.endr

-/* This is global to keep gas from relaxing the jumps */
-ENTRY(early_idt_handler)
+/* This is weak to keep gas from relaxing the jumps */
+WEAK(early_idt_handler)
 	cld

 	cmpl $2,(%rsp)		# X86_TRAP_NMI
--

gas/

	* config/tc-i386.c (shared): New.
	(OPTION_MSHARED): Likewise.
	(elf_symbol_resolved_in_segment_p): Add relocation argument.
	Check PLT relocations and shared.
	(md_estimate_size_before_relax): Pass fragP->fr_var to
	elf_symbol_resolved_in_segment_p.
	(md_longopts): Add -mshared.
	(md_show_usage): Likewise.
	(md_parse_option): Handle OPTION_MSHARED.
	* doc/c-i386.texi: Document -mshared.

gas/testsuite/

	* gas/i386/i386.exp: Don't run pcrel for ELF targets.  Run
	pcrel-elf, relax-4 and x86-64-relax-3 for ELF targets.
	* gas/i386/pcrel-elf.d: New file.
	* gas/i386/relax-4.d: Likewise.
	* gas/i386/x86-64-relax-3.d: Likewise.
	* gas/i386/relax-3.d: Pass -mshared to assembler.  Updated.
	* gas/i386/x86-64-relax-2.d: Likewise.
	* gas/i386/relax-3.s: Add test for PLT relocation.
2015-05-15 03:30:53 -07:00
..
all.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
as.texinfo Update GAS documentation to note that dollar local labels are only supported on some targets. 2015-05-06 13:13:10 +01:00
c-aarch64.texi [AArch64] Add support for the Samsung Exynos M1 processor 2015-04-01 21:00:41 +00:00
c-alpha.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-arc.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-arm.texi GAS ARM: Warn if the user creates a symbol with the same name as an instruction. 2015-04-30 11:17:55 +01:00
c-avr.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-bfin.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-cr16.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-cris.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-d10v.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-d30v.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-epiphany.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-h8300.texi Add support for the h8300-linux target. 2015-02-23 17:04:53 +00:00
c-hppa.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-i370.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-i386.texi Add -mshared option to x86 ELF assembler 2015-05-15 03:30:53 -07:00
c-i860.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-i960.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-ia64.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-ip2k.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-lm32.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-m32c.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-m32r.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-m68hc11.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-m68k.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-metag.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-microblaze.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-mips.texi Add i6400 entry to the MIPS CPU table. 2015-03-12 16:37:09 +00:00
c-mmix.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-msp430.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-mt.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-nds32.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-nios2.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-ns32k.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-pdp11.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-pj.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-ppc.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-rl78.texi Add support for G13 and G14 flag bits in RL78 ELF binaries. 2015-03-19 15:37:43 +00:00
c-rx.texi doc/c-rx.texi: Fix markup typos in last change. 2015-04-09 21:09:02 +02:00
c-s390.texi S/390: Add support for IBM z13. 2015-01-16 12:28:58 +01:00
c-score.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-sh.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-sh64.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-sparc.texi gas: support for the sparc %ncc condition codes register. 2015-05-06 09:26:23 -07:00
c-tic6x.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-tic54x.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-tilegx.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-tilepro.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-v850.texi Adds support for generating notes in V850 binaries. 2015-02-24 17:54:09 +00:00
c-vax.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-visium.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-xc16x.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-xgate.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-xstormy16.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-xtensa.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-z8k.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
c-z80.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
fdl.texi Change documentation license to FDL v1.3 2008-11-19 16:22:48 +00:00
h8.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
internals.texi ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Makefile.am ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Makefile.in Revert the AM_ZLIB change in gas 2015-03-31 06:39:57 -07:00