[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#767594: apt-dater: FTBFS: ld: failed to merge target specific data of file apt-dater.config



Source: apt-dater
Version: 1.0.0-1
Severity: important
Justification: fails to build from source (but built successfully in the past)

http://buildd.debian-ports.org/status/fetch.php?pkg=apt-dater&arch=m68k&ver=1.0.0-1&stamp=1414802346

make[3]: Entering directory '/«PKGBUILDDIR»/conf'
ld -r -b binary -o apt-dater.blob apt-dater.config
ld: failed to merge target specific data of file apt-dater.config
Makefile:437: recipe for target 'apt-dater.blob' failed
make[3]: *** [apt-dater.blob] Error 1

The reason here is you’re doing an invalid operation.
If you want to embed the apt-dater.config binary into
your program, you can do it like this:

$ cat >apt-dater.config.S <<'EOF'
	.section .comment
	.asciz	"version of apt-dater.config, in case you want to embed it"
	.section .rodata
	.global	aptdaterconfig
	.type	aptdaterconfig,@object
aptdaterconfig:
	.incbin	"apt-dater.config"
	.size	aptdaterconfig,.-aptdaterconfig
	.globl	aptdaterconfig_end
aptdaterconfig_end:
EOF
$ gcc -c -o apt-dater.config.o apt-dater.config.S

Then you have
	extern unsigned char *aptdaterconfig, *aptdaterconfig_end;
and can access the size using (aptdaterconfig_end - aptdaterconfig)
in C. You could also write it into the asm file, but that wastes 4
or 8 bytes (and you’d need the right asm pseudo-op for the target
architecture). Note that aptdaterconfig_end does not have a .type
because it’s just a label. Note that .S files are processed by $CC,
which invokes first cpp(1) on them (so /* … */ style comments are
fine to use) then as(1).

This works on all ELF platforms using GNU as. That is, all of Debian,
and probably all of contemporary Linux. I’m using it quite a bit in
MirBSD, e.g. to embed the kernel config into the kernel binary, and
to embed the manpage into the fdisk binary so it can be displayed
during runtime (helps the installer).

-- System Information:
Debian Release: jessie/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: m68k

Kernel: Linux 3.16-2-m68k
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to C.UTF-8)
Shell: /bin/sh linked to /bin/lksh


Reply to: