uspace: Work around reported docker /dev/stdout bug

Reportedly, using /dev/stdout as the destination of objcopy fails in a
docker container.  This may be docker/docker#11462.  This reformulation,
which uses a temporary file, is expected to work around the problem.

For more background, see machinekit/machinekit#876.

Reported-by: Michael Haberler <mah@mah.priv.at>
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
Jeff Epler 2016-02-21 12:52:03 -06:00
parent d5ae641f39
commit f87c0244cf
2 changed files with 4 additions and 2 deletions

View file

@ -960,7 +960,8 @@ modules: $(patsubst %.o,../rtlib/%.so,$(obj-m))
../rtlib/%.so:
$(ECHO) Linking $@
$(Q)ld -d -r -o objects/$*.tmp $^
$(Q)(echo '{ global : '; objcopy -j .rtapi_export -O binary objects/$*.tmp /dev/stdout | tr -s '\0' | xargs -r0 printf '%s;\n' | grep .; echo 'local : * ; };') > objects/$*.ver
$(Q)objcopy -j .rtapi_export -O binary objects/$*.tmp objects/$*.sym
$(Q)(echo '{ global : '; tr -s '\0' < objects/$*.sym | xargs -r0 printf '%s;\n' | grep .; echo 'local : * ; };') > objects/$*.ver
$(Q)$(CC) -shared -Bsymbolic $(LDFLAGS) -Wl,--version-script,objects/$*.ver -o $@ $^ -lm
RTFLAGS += -fno-strict-aliasing -fwrapv

View file

@ -117,7 +117,8 @@ $(foreach mod,$(patsubst %.o,%,$(obj-m)),\
%.so:
$(ECHO) Linking $@
$(Q)ld -d -r -o $*.tmp $^
$(Q)(echo '{ global : '; objcopy -j .rtapi_export -O binary $*.tmp /dev/stdout | tr -s '\0' | xargs -r0 printf '%s;\n' | grep .; echo 'local : * ; };') > $*.ver
$(Q)objcopy -j .rtapi_export -O binary $*.tmp $*.sym
$(Q)(echo '{ global : '; tr -s '\0' < $*.sym | xargs -r0 printf '%s;\n' | grep .; echo 'local : * ; };') > $*.ver
$(Q)$(CC) -shared -Bsymbolic $(LDFLAGS) -Wl,--version-script,$*.ver -o $@ $^ -lm
$(Q)ld -d -r -o $*.tmp $^
endif