Bug 19962 - R_ARM_COPY relocation generated with -znocopyreloc
Summary: R_ARM_COPY relocation generated with -znocopyreloc
Status: ASSIGNED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.25
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-17 15:07 UTC by David Crawshaw
Modified: 2019-01-03 13:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Proposed patch (525 bytes, patch)
2016-04-20 13:00 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Crawshaw 2016-04-17 15:07:00 UTC
Linking with -znocopyreloc has no effect on ARM. The result binary still contains an R_ARM_COPY relocation.

	$ cat data-ref.s
	.globl _start
		.p2align 4
	_start:
		bkpt

	.data
		.globl data_object
	object_reference:
		.long data_object
		.size object_reference,4

	$ cat libdata.s
		.data
		.globl data_object
		.type data_object, %object
		.size data_object, 4
	data_object:
		  .long 123

	$ as -o data-ref.o data-ref.s 
	$ as -o libdata.o libdata.s
	$ ld.bfd -shared -o libdata.so libdata.o
	$ ld.bfd -znocopyreloc -o data-ref data-ref.o libdata.so
	$ readelf -r data-ref

	Relocation section '.rel.dyn' at offset 0x20c contains 1 entries:
	 Offset     Info    Type            Sym.Value  Sym. Name
	000202c0  00000314 R_ARM_COPY        000202c0   data_object

Linking with ld.gold does the right thing:

	Relocation section '.rel.dyn' at offset 0x19c contains 1 entries:
	 Offset     Info    Type            Sym.Value  Sym. Name
	00009240  00000102 R_ARM_ABS32       00000000   data_object

Related to bug 16177 (I borrowed the example program from there).
Comment 1 Nick Clifton 2016-04-20 13:00:51 UTC
Created attachment 9208 [details]
Proposed patch

Hi David,

  Please try out this patch.

Cheers
  Nick
Comment 2 Maxim Kuvyrkov 2019-01-03 13:02:05 UTC
Hi David,

Any feedback on Nick's patch?